Add sqlite3 Schema
This commit is contained in:
parent
e0974f5ff2
commit
944a3163e9
53
db/sqlite.sql
Normal file
53
db/sqlite.sql
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS [ServerSettings] (
|
||||||
|
[SettingID] INTEGER PRIMARY KEY,
|
||||||
|
[Name] TEXT NOT NULL,
|
||||||
|
[Description] TEXT NOT NULL,
|
||||||
|
[Value] TEXT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS [Users] (
|
||||||
|
[UserID] INTEGER PRIMARY KEY,
|
||||||
|
[Name] TEXT NOT NULL,
|
||||||
|
[Email] TEXT,
|
||||||
|
[AuthType] TEXT NOT NULL,
|
||||||
|
[Salt] TEXT,
|
||||||
|
[HashedPWSalt] TEXT
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS [Items] (
|
||||||
|
[ItemID] INTEGER PRIMARY KEY,
|
||||||
|
[UserID] INTEGER NOT NULL,
|
||||||
|
[EXIFDate] TEXT NOT NULL,
|
||||||
|
[UploadDate] TEXT NOT NULL,
|
||||||
|
[Latitude] TEXT,
|
||||||
|
[Longitude] TEXT,
|
||||||
|
[Type] INTEGER, /* 0 = Photo, 1 = Video */
|
||||||
|
[RelPath] TEXT NOT NULL,
|
||||||
|
FOREIGN KEY (UserID) REFERENCES Users(UserID)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS [Tags] (
|
||||||
|
[TagID] INTEGER PRIMARY KEY,
|
||||||
|
[TagName] TEXT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS [ItemTags] (
|
||||||
|
[ItemID] INTEGER NOT NULL,
|
||||||
|
[TagID] INTEGER NOT NULL,
|
||||||
|
FOREIGN KEY (ItemID) REFERENCES Items(ItemID)
|
||||||
|
FOREIGN KEY (TagID) REFERENCES Tags(TagID)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS [Albums] (
|
||||||
|
[AlbumID] INTEGER PRIMARY KEY,
|
||||||
|
[UserID] INTEGER NOT NULL,
|
||||||
|
[Name] TEXT NOT NULL,
|
||||||
|
FOREIGN KEY (UserID) REFERENCES Users(UserID)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS [ItemAlbums] (
|
||||||
|
[ItemID] INTEGER NOT NULL,
|
||||||
|
[AlbumID] INTEGER NOT NULL,
|
||||||
|
FOREIGN KEY (ItemID) REFERENCES Items(ItemID)
|
||||||
|
FOREIGN KEY (AlbumID) REFERENCES Albums(AlbumID)
|
||||||
|
);
|
Reference in New Issue
Block a user