Remove tabs

This commit is contained in:
Evan Reichard 2021-01-04 01:55:41 -05:00
parent e8003f15d7
commit 5b068f607c
3 changed files with 39 additions and 39 deletions

View File

@ -1,53 +1,53 @@
CREATE TABLE IF NOT EXISTS [ServerSettings] (
[settingID] INTEGER PRIMARY KEY,
[name] TEXT NOT NULL,
[description] TEXT NOT NULL,
[value] TEXT NOT NULL
[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
[userID] INTEGER PRIMARY KEY,
[name] TEXT NOT NULL,
[email] TEXT,
[authType] TEXT NOT NULL,
[salt] TEXT,
[hashedPWSalt] TEXT
);
CREATE TABLE IF NOT EXISTS [MediaItems] (
[mediaID] INTEGER PRIMARY KEY,
[userID] INTEGER NOT NULL,
[EXIFDate] TEXT NOT NULL,
[uploadDate] TEXT NOT NULL,
[latitude] TEXT,
[longitude] TEXT,
[mediaType] INTEGER, /* 0 = Photo, 1 = Video */
[relPath] TEXT NOT NULL,
[mediaID] INTEGER PRIMARY KEY,
[userID] INTEGER NOT NULL,
[EXIFDate] TEXT NOT NULL,
[uploadDate] TEXT NOT NULL,
[latitude] TEXT,
[longitude] TEXT,
[mediaType] 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,
[tagID] INTEGER PRIMARY KEY,
[name] TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS [MediaTags] (
[mediaID] INTEGER NOT NULL,
[tagID] INTEGER NOT NULL,
[mediaID] INTEGER NOT NULL,
[tagID] INTEGER NOT NULL,
FOREIGN KEY (mediaID) REFERENCES MediaItems(mediaID)
FOREIGN KEY (tagID) REFERENCES Tags(tagID)
);
CREATE TABLE IF NOT EXISTS [Albums] (
[albumID] INTEGER PRIMARY KEY,
[albumID] INTEGER PRIMARY KEY,
[userID] INTEGER NOT NULL,
[name] TEXT NOT NULL,
FOREIGN KEY (userID) REFERENCES Users(userID)
);
CREATE TABLE IF NOT EXISTS [MediaAlbums] (
[mediaID] INTEGER NOT NULL,
[albumID] INTEGER NOT NULL,
[mediaID] INTEGER NOT NULL,
[albumID] INTEGER NOT NULL,
FOREIGN KEY (mediaID) REFERENCES MediaItems(mediaID)
FOREIGN KEY (albumID) REFERENCES Albums(albumID)
);

View File

@ -8,14 +8,14 @@ import (
)
type MediaItem struct {
mediaID int
userID int
EXIFDate string
uploadDate string
latitude string
longitude string
mediaType int
relPath string
mediaID int
userID int
EXIFDate string
uploadDate string
latitude string
longitude string
mediaType int
relPath string
}
func init() {
@ -23,8 +23,8 @@ func init() {
}
func ItemsFromAlbum(userID int, albumID int) []MediaItem {
database, _ := sql.Open("sqlite3", "./db/imagini.db")
rows, _ := database.Query(`
database, _ := sql.Open("sqlite3", "./db/imagini.db")
rows, _ := database.Query(`
SELECT
MediaItems.*
FROM
@ -46,8 +46,8 @@ func ItemsFromAlbum(userID int, albumID int) []MediaItem {
}
func ItemsFromTags(userID int, tagID int) []MediaItem {
database, _ := sql.Open("sqlite3", "./db/imagini.db")
rows, _ := database.Query(`
database, _ := sql.Open("sqlite3", "./db/imagini.db")
rows, _ := database.Query(`
SELECT
MediaItems.*
FROM
@ -69,7 +69,7 @@ func ItemsFromTags(userID int, tagID int) []MediaItem {
}
func IndexMediaItems(newItems []MediaItem) {
database, _ := sql.Open("sqlite3", "./db/imagini.db")
database, _ := sql.Open("sqlite3", "./db/imagini.db")
statement, _ := database.Prepare(`
INSERT INTO MediaItems (
userID,

View File

@ -1,8 +1,8 @@
package main
import (
"os"
"log"
"os"
"log"
"reichard.io/imagini/cmd"
"github.com/urfave/cli/v2"
)