urlsnail/database/schema/sqlite-schema.sql

10 lines
1.3 KiB
MySQL
Raw Normal View History

CREATE TABLE IF NOT EXISTS "migrations" ("id" integer primary key autoincrement not null, "migration" varchar not null, "batch" integer not null);
CREATE TABLE IF NOT EXISTS "bookmarks" ("id" integer primary key autoincrement not null, "href" varchar not null, "title" varchar not null, "description" varchar not null, "created_at" datetime, "updated_at" datetime);
CREATE TABLE IF NOT EXISTS "tags" ("id" integer primary key autoincrement not null, "name" varchar not null, "created_at" datetime, "updated_at" datetime);
CREATE TABLE IF NOT EXISTS "bookmarks_tags" ("id" integer primary key autoincrement not null, "bookmark_id" integer not null, "tag_id" integer not null, "created_at" datetime, "updated_at" datetime, foreign key("bookmark_id") references "bookmarks"("id"), foreign key("tag_id") references "tags"("id"));
CREATE TABLE IF NOT EXISTS "sessions" ("id" varchar not null, "user_id" integer, "ip_address" varchar, "user_agent" text, "payload" text not null, "last_activity" integer not null, primary key ("id"));
CREATE INDEX "sessions_user_id_index" on "sessions" ("user_id");
CREATE INDEX "sessions_last_activity_index" on "sessions" ("last_activity");
INSERT INTO migrations VALUES(1,'2024_05_24_204027_create_tables',1);
INSERT INTO migrations VALUES(2,'2024_05_24_224743_create_sessions_table',2);