CREATE TABLE IF NOT EXISTS "migrations" ("id" integer not null primary key autoincrement, "migration" varchar not null, "batch" integer not null);
CREATE TABLE IF NOT EXISTS "revisions" ("id" integer not null primary key autoincrement, "revisionable_type" varchar not null, "revisionable_id" integer not null, "user_id" integer, "key" varchar not null, "old_value" text, "new_value" text, "created_at" datetime, "updated_at" datetime);
CREATE INDEX "revisions_revisionable_id_revisionable_type_index" on "revisions" ("revisionable_id", "revisionable_type");
CREATE TABLE IF NOT EXISTS "users" ("id" integer not null primary key autoincrement, "name" varchar not null, "email" varchar not null, "password" varchar not null, "remember_token" varchar, "created_at" datetime, "updated_at" datetime, "two_factor_secret" text, "two_factor_recovery_codes" text, "api_token" varchar);
CREATE UNIQUE INDEX "users_email_unique" on "users" ("email");
CREATE TABLE IF NOT EXISTS "password_resets" ("email" varchar not null, "token" varchar not null, "created_at" datetime);
CREATE INDEX "password_resets_email_index" on "password_resets" ("email");
CREATE TABLE IF NOT EXISTS "tags" ("id" integer not null primary key autoincrement, "user_id" integer not null, "name" text not null, "is_private" tinyint(1) not null default '0', "created_at" datetime, "updated_at" datetime, "deleted_at" datetime);
CREATE TABLE IF NOT EXISTS "link_tags" ("link_id" integer not null, "tag_id" integer not null, primary key ("link_id", "tag_id"));
CREATE TABLE IF NOT EXISTS "notes" ("id" integer not null primary key autoincrement, "user_id" integer not null, "link_id" integer not null, "note" text not null, "is_private" tinyint(1) not null default '0', "created_at" datetime, "updated_at" datetime, "deleted_at" datetime);
CREATE TABLE IF NOT EXISTS "settings" ("id" integer not null primary key autoincrement, "user_id" integer, "key" varchar not null, "value" text);
CREATE TABLE IF NOT EXISTS "permissions" ("id" integer not null primary key autoincrement, "name" varchar not null, "guard_name" varchar not null, "created_at" datetime, "updated_at" datetime);
CREATE TABLE IF NOT EXISTS "roles" ("id" integer not null primary key autoincrement, "name" varchar not null, "guard_name" varchar not null, "created_at" datetime, "updated_at" datetime);
CREATE TABLE IF NOT EXISTS "model_has_permissions" ("permission_id" integer not null, "model_type" varchar not null, "model_id" integer not null, foreign key("permission_id") references "permissions"("id") on delete cascade, primary key ("permission_id", "model_id", "model_type"));
CREATE INDEX "model_has_permissions_model_id_model_type_index" on "model_has_permissions" ("model_id", "model_type");
CREATE TABLE IF NOT EXISTS "model_has_roles" ("role_id" integer not null, "model_type" varchar not null, "model_id" integer not null, foreign key("role_id") references "roles"("id") on delete cascade, primary key ("role_id", "model_id", "model_type"));
CREATE INDEX "model_has_roles_model_id_model_type_index" on "model_has_roles" ("model_id", "model_type");
CREATE TABLE IF NOT EXISTS "role_has_permissions" ("permission_id" integer not null, "role_id" integer not null, foreign key("permission_id") references "permissions"("id") on delete cascade, foreign key("role_id") references "roles"("id") on delete cascade, primary key ("permission_id", "role_id"));
CREATE TABLE IF NOT EXISTS "jobs" ("id" integer not null primary key autoincrement, "queue" varchar not null, "payload" text not null, "attempts" integer not null, "reserved_at" integer, "available_at" integer not null, "created_at" integer not null);
CREATE INDEX "jobs_queue_index" on "jobs" ("queue");
CREATE TABLE IF NOT EXISTS "failed_jobs" ("id" integer not null primary key autoincrement, "connection" text not null, "queue" text not null, "payload" text not null, "exception" text not null, "failed_at" datetime default CURRENT_TIMESTAMP not null);
CREATE TABLE IF NOT EXISTS "lists" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER NOT NULL, name CLOB NOT NULL COLLATE BINARY, description CLOB DEFAULT NULL COLLATE BINARY, is_private BOOLEAN DEFAULT 0 NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL);
CREATE TABLE IF NOT EXISTS "link_lists" ("link_id" integer not null, "list_id" integer not null, primary key ("link_id", "list_id"));
CREATE TABLE IF NOT EXISTS "personal_access_tokens" ("id" integer not null primary key autoincrement, "tokenable_type" varchar not null, "tokenable_id" integer not null, "name" varchar not null, "token" varchar not null, "abilities" text, "last_used_at" datetime, "created_at" datetime, "updated_at" datetime);
CREATE INDEX "personal_access_tokens_tokenable_type_tokenable_id_index" on "personal_access_tokens" ("tokenable_type", "tokenable_id");
CREATE UNIQUE INDEX "personal_access_tokens_token_unique" on "personal_access_tokens" ("token");
CREATE TABLE links (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER NOT NULL, url CLOB NOT NULL COLLATE BINARY, title CLOB NOT NULL COLLATE BINARY, description CLOB DEFAULT NULL COLLATE BINARY, is_private BOOLEAN DEFAULT 0 NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, icon VARCHAR(255) DEFAULT NULL COLLATE BINARY, status INTEGER DEFAULT 1 NOT NULL, check_disabled BOOLEAN DEFAULT 0 NOT NULL, thumbnail CLOB DEFAULT NULL COLLATE BINARY);
INSERT INTO migrations VALUES(1,'2013_04_09_062329_create_revisions_table',1);
INSERT INTO migrations VALUES(2,'2014_10_12_000000_create_users_table',1);
INSERT INTO migrations VALUES(3,'2014_10_12_100000_create_password_resets_table',1);
INSERT INTO migrations VALUES(4,'2014_10_12_200000_add_two_factor_columns_to_users_table',1);
INSERT INTO migrations VALUES(5,'2018_08_22_212248_create_taxonomy_tables',1);
INSERT INTO migrations VALUES(6,'2018_08_22_212358_create_link_tables',1);
INSERT INTO migrations VALUES(7,'2018_08_22_213055_create_note_tables',1);
INSERT INTO migrations VALUES(8,'2018_09_27_214216_create_settings_table',1);
INSERT INTO migrations VALUES(9,'2019_01_30_153129_update_link_table_for_icon',1);
INSERT INTO migrations VALUES(10,'2019_02_07_223113_add_user_api_token',1);
INSERT INTO migrations VALUES(11,'2019_02_10_221213_create_permission_tables',1);
INSERT INTO migrations VALUES(12,'2019_02_11_143743_add_link_status',1);
INSERT INTO migrations VALUES(13,'2019_07_16_173805_create_jobs_table',1);
INSERT INTO migrations VALUES(14,'2019_07_16_175247_create_failed_jobs_table',1);
INSERT INTO migrations VALUES(15,'2019_10_29_135735_move_category_to_list_table',1);
INSERT INTO migrations VALUES(16,'2019_12_14_000001_create_personal_access_tokens_table',1);
INSERT INTO migrations VALUES(17,'2020_02_28_153446_add_check_disabled_to_links_table',1);
INSERT INTO migrations VALUES(18,'2020_05_04_230306_convert_link_privacy_setting',1);
INSERT INTO migrations VALUES(19,'2020_05_06_153715_enable_internet_archive_backup_setting',1);
INSERT INTO migrations VALUES(20,'2020_10_21_104548_migrate_link_icons',1);
INSERT INTO migrations VALUES(21,'2021_04_15_165138_add_thumbnail_column_to_links_table',1);
INSERT INTO migrations VALUES(22,'2021_05_10_123913_change_link_thumbnail_field',1);
INSERT INTO migrations VALUES(23,'2022_03_24_222856_add_completed_setup_setting',1);
