use autoload()

This commit is contained in:
2020-09-20 17:11:30 +02:00
parent a3cbd71fa3
commit b53b91efc0
7 changed files with 105 additions and 55 deletions
+14
View File
@@ -0,0 +1,14 @@
local Model = require("lapis.db.model").Model
-- airtime
local Airtimes = Model:extend("airtimes", {
-- "airtime", types.time
timestamp = true,
relations = {
{"tracks", belongs_to = "Tracks"},
{"stations", has_one = "Stations"}
}
})
return Airtimes
+12
View File
@@ -0,0 +1,12 @@
local Model = require("lapis.db.model").Model
-- artists
local Artists = Model:extend("artists", {
-- "name", types.varchar
-- "date", types.date
-- "bio", types.text
-- "urls", types.text
timestamp = true
})
return Artists
+12
View File
@@ -0,0 +1,12 @@
local Model = require("lapis.db.model").Model
-- stations
-- - name/id
local Stations = Model:extend("stations", {
-- "station", types.integer
-- "name", types.varchar
timestamp = true
})
return Stations
+12
View File
@@ -0,0 +1,12 @@
local Model = require("lapis.db.model").Model
-- track_artists
local TrackArtists = Model:extend("track_artists", {
timestamp = true,
relations = {
{"track", belongs_to = "Tracks"},
{"artist", belongs_to = "Artists"}
}
})
return TrackArtists
+17
View File
@@ -0,0 +1,17 @@
local Model = require("lapis.db.model").Model
-- tracks
-- - title/unique name == `lower(artist+title)`
local Tracks = Model:extend("tracks", {
-- "name", types.varchar
-- "unique_name", types.varchar
-- "year", types.integer
timestamp = true,
-- relations = {
-- {"copies", has_many = "Tracks"},
-- {"original", has_one = "Tracks"}
-- }
})
return Tracks