This repository has been archived on 2023-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
imagini/db/sqlite.sql

54 lines
1.3 KiB
MySQL
Raw Normal View History

2021-01-04 02:21:45 +00:00
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)
);