Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: update migrate scripts
johnnyjoy39d4d4f4f318
diff --git a/store/migration/mysql/prod/0.17/00__inbox.sql b/store/migration/mysql/0.17/00__inbox.sqlsimilarity index 100%rename from store/migration/mysql/prod/0.17/00__inbox.sqlrename to store/migration/mysql/0.17/00__inbox.sqldiff --git a/store/migration/mysql/prod/0.17/01__delete_activity.sql b/store/migration/mysql/0.17/01__delete_activity.sqlsimilarity index 100%rename from store/migration/mysql/prod/0.17/01__delete_activity.sqlrename to store/migration/mysql/0.17/01__delete_activity.sqldiff --git a/store/migration/mysql/prod/0.18/00__extend_text.sql b/store/migration/mysql/0.18/00__extend_text.sqlsimilarity index 100%rename from store/migration/mysql/prod/0.18/00__extend_text.sqlrename to store/migration/mysql/0.18/00__extend_text.sqldiff --git a/store/migration/mysql/prod/0.18/01__webhook.sql b/store/migration/mysql/0.18/01__webhook.sqlsimilarity index 100%rename from store/migration/mysql/prod/0.18/01__webhook.sqlrename to store/migration/mysql/0.18/01__webhook.sqldiff --git a/store/migration/mysql/prod/0.18/02__user_setting.sql b/store/migration/mysql/0.18/02__user_setting.sqlsimilarity index 100%rename from store/migration/mysql/prod/0.18/02__user_setting.sqlrename to store/migration/mysql/0.18/02__user_setting.sqldiff --git a/store/migration/mysql/prod/0.19/00__add_resource_name.sql b/store/migration/mysql/0.19/00__add_resource_name.sqlsimilarity index 100%rename from store/migration/mysql/prod/0.19/00__add_resource_name.sqlrename to store/migration/mysql/0.19/00__add_resource_name.sqldiff --git a/store/migration/mysql/prod/0.20/00__reaction.sql b/store/migration/mysql/0.20/00__reaction.sqlsimilarity index 100%rename from store/migration/mysql/prod/0.20/00__reaction.sqlrename to store/migration/mysql/0.20/00__reaction.sqldiff --git a/store/migration/mysql/prod/0.21/00__user_description.sql b/store/migration/mysql/0.21/00__user_description.sqlsimilarity index 100%rename from store/migration/mysql/prod/0.21/00__user_description.sqlrename to store/migration/mysql/0.21/00__user_description.sqldiff --git a/store/migration/mysql/prod/0.21/01__rename_uid.sql b/store/migration/mysql/0.21/01__rename_uid.sqlsimilarity index 100%rename from store/migration/mysql/prod/0.21/01__rename_uid.sqlrename to store/migration/mysql/0.21/01__rename_uid.sqldiff --git a/store/migration/mysql/prod/0.22/00__resource_storage_type.sql b/store/migration/mysql/0.22/00__resource_storage_type.sqlsimilarity index 100%rename from store/migration/mysql/prod/0.22/00__resource_storage_type.sqlrename to store/migration/mysql/0.22/00__resource_storage_type.sqldiff --git a/store/migration/mysql/prod/0.22/01__memo_tags.sql b/store/migration/mysql/0.22/01__memo_tags.sqlsimilarity index 100%rename from store/migration/mysql/prod/0.22/01__memo_tags.sqlrename to store/migration/mysql/0.22/01__memo_tags.sqldiff --git a/store/migration/mysql/prod/0.22/02__memo_payload.sql b/store/migration/mysql/0.22/02__memo_payload.sqlsimilarity index 100%rename from store/migration/mysql/prod/0.22/02__memo_payload.sqlrename to store/migration/mysql/0.22/02__memo_payload.sqldiff --git a/store/migration/mysql/prod/0.22/03__drop_tag.sql b/store/migration/mysql/0.22/03__drop_tag.sqlsimilarity index 100%rename from store/migration/mysql/prod/0.22/03__drop_tag.sqlrename to store/migration/mysql/0.22/03__drop_tag.sqldiff --git a/store/migration/mysql/prod/0.23/00__reactions.sql b/store/migration/mysql/0.23/00__reactions.sqlsimilarity index 100%rename from store/migration/mysql/prod/0.23/00__reactions.sqlrename to store/migration/mysql/0.23/00__reactions.sqldiff --git a/store/migration/mysql/prod/LATEST.sql b/store/migration/mysql/LATEST.sqlsimilarity index 100%rename from store/migration/mysql/prod/LATEST.sqlrename to store/migration/mysql/LATEST.sqldiff --git a/store/migration/mysql/dev/LATEST.sql b/store/migration/mysql/dev/LATEST.sqldeleted file mode 100644index 347736aef..000000000--- a/store/migration/mysql/dev/LATEST.sql+++ /dev/null@@ -1,131 +0,0 @@--- migration_history-CREATE TABLE `migration_history` (- `version` VARCHAR(256) NOT NULL PRIMARY KEY,- `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP-);---- system_setting-CREATE TABLE `system_setting` (- `name` VARCHAR(256) NOT NULL PRIMARY KEY,- `value` LONGTEXT NOT NULL,- `description` TEXT NOT NULL-);---- user-CREATE TABLE `user` (- `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,- `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,- `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,- `row_status` VARCHAR(256) NOT NULL DEFAULT 'NORMAL',- `username` VARCHAR(256) NOT NULL UNIQUE,- `role` VARCHAR(256) NOT NULL DEFAULT 'USER',- `email` VARCHAR(256) NOT NULL DEFAULT '',- `nickname` VARCHAR(256) NOT NULL DEFAULT '',- `password_hash` VARCHAR(256) NOT NULL,- `avatar_url` LONGTEXT NOT NULL,- `description` VARCHAR(256) NOT NULL DEFAULT ''-);---- user_setting-CREATE TABLE `user_setting` (- `user_id` INT NOT NULL,- `key` VARCHAR(256) NOT NULL,- `value` LONGTEXT NOT NULL,- UNIQUE(`user_id`,`key`)-);---- memo-CREATE TABLE `memo` (- `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,- `uid` VARCHAR(256) NOT NULL UNIQUE,- `creator_id` INT NOT NULL,- `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,- `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,- `row_status` VARCHAR(256) NOT NULL DEFAULT 'NORMAL',- `content` TEXT NOT NULL,- `visibility` VARCHAR(256) NOT NULL DEFAULT 'PRIVATE',- `payload` JSON NOT NULL-);---- memo_organizer-CREATE TABLE `memo_organizer` (- `memo_id` INT NOT NULL,- `user_id` INT NOT NULL,- `pinned` INT NOT NULL DEFAULT '0',- UNIQUE(`memo_id`,`user_id`)-);---- memo_relation-CREATE TABLE `memo_relation` (- `memo_id` INT NOT NULL,- `related_memo_id` INT NOT NULL,- `type` VARCHAR(256) NOT NULL,- UNIQUE(`memo_id`,`related_memo_id`,`type`)-);---- resource-CREATE TABLE `resource` (- `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,- `uid` VARCHAR(256) NOT NULL UNIQUE,- `creator_id` INT NOT NULL,- `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,- `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,- `filename` TEXT NOT NULL,- `blob` MEDIUMBLOB,- `type` VARCHAR(256) NOT NULL DEFAULT '',- `size` INT NOT NULL DEFAULT '0',- `memo_id` INT DEFAULT NULL,- `storage_type` VARCHAR(256) NOT NULL DEFAULT '',- `reference` VARCHAR(256) NOT NULL DEFAULT '',- `payload` TEXT NOT NULL-);---- activity-CREATE TABLE `activity` (- `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,- `creator_id` INT NOT NULL,- `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,- `type` VARCHAR(256) NOT NULL DEFAULT '',- `level` VARCHAR(256) NOT NULL DEFAULT 'INFO',- `payload` TEXT NOT NULL-);---- idp-CREATE TABLE `idp` (- `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,- `name` TEXT NOT NULL,- `type` TEXT NOT NULL,- `identifier_filter` VARCHAR(256) NOT NULL DEFAULT '',- `config` TEXT NOT NULL-);---- inbox-CREATE TABLE `inbox` (- `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,- `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,- `sender_id` INT NOT NULL,- `receiver_id` INT NOT NULL,- `status` TEXT NOT NULL,- `message` TEXT NOT NULL-);---- webhook-CREATE TABLE `webhook` (- `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,- `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,- `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,- `row_status` VARCHAR(256) NOT NULL DEFAULT 'NORMAL',- `creator_id` INT NOT NULL,- `name` TEXT NOT NULL,- `url` TEXT NOT NULL-);---- reaction-CREATE TABLE `reaction` (- `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,- `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,- `creator_id` INT NOT NULL,- `content_id` VARCHAR(256) NOT NULL,- `reaction_type` VARCHAR(256) NOT NULL,- UNIQUE(`creator_id`,`content_id`,`reaction_type`)-);diff --git a/store/migration/postgres/prod/0.19/00__add_resource_name.sql b/store/migration/postgres/0.19/00__add_resource_name.sqlsimilarity index 100%rename from store/migration/postgres/prod/0.19/00__add_resource_name.sqlrename to store/migration/postgres/0.19/00__add_resource_name.sqldiff --git a/store/migration/postgres/prod/0.20/00__reaction.sql b/store/migration/postgres/0.20/00__reaction.sqlsimilarity index 100%rename from store/migration/postgres/prod/0.20/00__reaction.sqlrename to store/migration/postgres/0.20/00__reaction.sqldiff --git a/store/migration/postgres/prod/0.21/00__user_description.sql b/store/migration/postgres/0.21/00__user_description.sqlsimilarity index 100%rename from store/migration/postgres/prod/0.21/00__user_description.sqlrename to store/migration/postgres/0.21/00__user_description.sqldiff --git a/store/migration/postgres/prod/0.21/01__rename_uid.sql b/store/migration/postgres/0.21/01__rename_uid.sqlsimilarity index 100%rename from store/migration/postgres/prod/0.21/01__rename_uid.sqlrename to store/migration/postgres/0.21/01__rename_uid.sqldiff --git a/store/migration/postgres/prod/0.22/00__resource_storage_type.sql b/store/migration/postgres/0.22/00__resource_storage_type.sqlsimilarity index 100%rename from store/migration/postgres/prod/0.22/00__resource_storage_type.sqlrename to store/migration/postgres/0.22/00__resource_storage_type.sqldiff --git a/store/migration/postgres/prod/0.22/01__memo_tags.sql b/store/migration/postgres/0.22/01__memo_tags.sqlsimilarity index 100%rename from store/migration/postgres/prod/0.22/01__memo_tags.sqlrename to store/migration/postgres/0.22/01__memo_tags.sqldiff --git a/store/migration/postgres/prod/0.22/02__memo_payload.sql b/store/migration/postgres/0.22/02__memo_payload.sqlsimilarity index 100%rename from store/migration/postgres/prod/0.22/02__memo_payload.sqlrename to store/migration/postgres/0.22/02__memo_payload.sqldiff --git a/store/migration/postgres/prod/0.22/03__drop_tag.sql b/store/migration/postgres/0.22/03__drop_tag.sqlsimilarity index 100%rename from store/migration/postgres/prod/0.22/03__drop_tag.sqlrename to store/migration/postgres/0.22/03__drop_tag.sqldiff --git a/store/migration/postgres/prod/0.23/00__reactions.sql b/store/migration/postgres/0.23/00__reactions.sqlsimilarity index 100%rename from store/migration/postgres/prod/0.23/00__reactions.sqlrename to store/migration/postgres/0.23/00__reactions.sqldiff --git a/store/migration/postgres/prod/LATEST.sql b/store/migration/postgres/LATEST.sqlsimilarity index 100%rename from store/migration/postgres/prod/LATEST.sqlrename to store/migration/postgres/LATEST.sqldiff --git a/store/migration/postgres/dev/LATEST.sql b/store/migration/postgres/dev/LATEST.sqldeleted file mode 100644index f37025b5b..000000000--- a/store/migration/postgres/dev/LATEST.sql+++ /dev/null@@ -1,131 +0,0 @@--- migration_history-CREATE TABLE migration_history (- version TEXT NOT NULL PRIMARY KEY,- created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW())-);---- system_setting-CREATE TABLE system_setting (- name TEXT NOT NULL PRIMARY KEY,- value TEXT NOT NULL,- description TEXT NOT NULL-);---- user-CREATE TABLE "user" (- id SERIAL PRIMARY KEY,- created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()),- updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()),- row_status TEXT NOT NULL DEFAULT 'NORMAL',- username TEXT NOT NULL UNIQUE,- role TEXT NOT NULL DEFAULT 'USER',- email TEXT NOT NULL DEFAULT '',- nickname TEXT NOT NULL DEFAULT '',- password_hash TEXT NOT NULL,- avatar_url TEXT NOT NULL,- description TEXT NOT NULL DEFAULT ''-);---- user_setting-CREATE TABLE user_setting (- user_id INTEGER NOT NULL,- key TEXT NOT NULL,- value TEXT NOT NULL,- UNIQUE(user_id, key)-);---- memo-CREATE TABLE memo (- id SERIAL PRIMARY KEY,- uid TEXT NOT NULL UNIQUE,- creator_id INTEGER NOT NULL,- created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()),- updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()),- row_status TEXT NOT NULL DEFAULT 'NORMAL',- content TEXT NOT NULL,- visibility TEXT NOT NULL DEFAULT 'PRIVATE',- payload JSONB NOT NULL DEFAULT '{}'-);---- memo_organizer-CREATE TABLE memo_organizer (- memo_id INTEGER NOT NULL,- user_id INTEGER NOT NULL,- pinned INTEGER NOT NULL DEFAULT 0,- UNIQUE(memo_id, user_id)-);---- memo_relation-CREATE TABLE memo_relation (- memo_id INTEGER NOT NULL,- related_memo_id INTEGER NOT NULL,- type TEXT NOT NULL,- UNIQUE(memo_id, related_memo_id, type)-);---- resource-CREATE TABLE resource (- id SERIAL PRIMARY KEY,- uid TEXT NOT NULL UNIQUE,- creator_id INTEGER NOT NULL,- created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()),- updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()),- filename TEXT NOT NULL,- blob BYTEA,- type TEXT NOT NULL DEFAULT '',- size INTEGER NOT NULL DEFAULT 0,- memo_id INTEGER DEFAULT NULL,- storage_type TEXT NOT NULL DEFAULT '',- reference TEXT NOT NULL DEFAULT '',- payload TEXT NOT NULL DEFAULT '{}'-);---- activity-CREATE TABLE activity (- id SERIAL PRIMARY KEY,- creator_id INTEGER NOT NULL,- created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()),- type TEXT NOT NULL DEFAULT '',- level TEXT NOT NULL DEFAULT 'INFO',- payload JSONB NOT NULL DEFAULT '{}'-);---- idp-CREATE TABLE idp (- id SERIAL PRIMARY KEY,- name TEXT NOT NULL,- type TEXT NOT NULL,- identifier_filter TEXT NOT NULL DEFAULT '',- config JSONB NOT NULL DEFAULT '{}'-);---- inbox-CREATE TABLE inbox (- id SERIAL PRIMARY KEY,- created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()),- sender_id INTEGER NOT NULL,- receiver_id INTEGER NOT NULL,- status TEXT NOT NULL,- message TEXT NOT NULL-);---- webhook-CREATE TABLE webhook (- id SERIAL PRIMARY KEY,- created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()),- updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()),- row_status TEXT NOT NULL DEFAULT 'NORMAL',- creator_id INTEGER NOT NULL,- name TEXT NOT NULL,- url TEXT NOT NULL-);---- reaction-CREATE TABLE reaction (- id SERIAL PRIMARY KEY,- created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()),- creator_id INTEGER NOT NULL,- content_id TEXT NOT NULL,- reaction_type TEXT NOT NULL,- UNIQUE(creator_id, content_id, reaction_type)-);diff --git a/store/migration/sqlite/prod/0.10/00__activity.sql b/store/migration/sqlite/0.10/00__activity.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.10/00__activity.sqlrename to store/migration/sqlite/0.10/00__activity.sqldiff --git a/store/migration/sqlite/prod/0.11/00__user_avatar.sql b/store/migration/sqlite/0.11/00__user_avatar.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.11/00__user_avatar.sqlrename to store/migration/sqlite/0.11/00__user_avatar.sqldiff --git a/store/migration/sqlite/prod/0.11/01__idp.sql b/store/migration/sqlite/0.11/01__idp.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.11/01__idp.sqlrename to store/migration/sqlite/0.11/01__idp.sqldiff --git a/store/migration/sqlite/prod/0.11/02__storage.sql b/store/migration/sqlite/0.11/02__storage.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.11/02__storage.sqlrename to store/migration/sqlite/0.11/02__storage.sqldiff --git a/store/migration/sqlite/prod/0.12/00__user_setting.sql b/store/migration/sqlite/0.12/00__user_setting.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.12/00__user_setting.sqlrename to store/migration/sqlite/0.12/00__user_setting.sqldiff --git a/store/migration/sqlite/prod/0.12/01__system_setting.sql b/store/migration/sqlite/0.12/01__system_setting.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.12/01__system_setting.sqlrename to store/migration/sqlite/0.12/01__system_setting.sqldiff --git a/store/migration/sqlite/prod/0.12/03__resource_internal_path.sql b/store/migration/sqlite/0.12/03__resource_internal_path.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.12/03__resource_internal_path.sqlrename to store/migration/sqlite/0.12/03__resource_internal_path.sqldiff --git a/store/migration/sqlite/prod/0.12/04__resource_public_id.sql b/store/migration/sqlite/0.12/04__resource_public_id.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.12/04__resource_public_id.sqlrename to store/migration/sqlite/0.12/04__resource_public_id.sqldiff --git a/store/migration/sqlite/prod/0.13/00__memo_relation.sql b/store/migration/sqlite/0.13/00__memo_relation.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.13/00__memo_relation.sqlrename to store/migration/sqlite/0.13/00__memo_relation.sqldiff --git a/store/migration/sqlite/prod/0.13/01__remove_memo_organizer_id.sql b/store/migration/sqlite/0.13/01__remove_memo_organizer_id.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.13/01__remove_memo_organizer_id.sqlrename to store/migration/sqlite/0.13/01__remove_memo_organizer_id.sqldiff --git a/store/migration/sqlite/prod/0.14/00__drop_resource_public_id.sql b/store/migration/sqlite/0.14/00__drop_resource_public_id.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.14/00__drop_resource_public_id.sqlrename to store/migration/sqlite/0.14/00__drop_resource_public_id.sqldiff --git a/store/migration/sqlite/prod/0.14/01__create_indexes.sql b/store/migration/sqlite/0.14/01__create_indexes.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.14/01__create_indexes.sqlrename to store/migration/sqlite/0.14/01__create_indexes.sqldiff --git a/store/migration/sqlite/prod/0.15/00__drop_user_open_id.sql b/store/migration/sqlite/0.15/00__drop_user_open_id.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.15/00__drop_user_open_id.sqlrename to store/migration/sqlite/0.15/00__drop_user_open_id.sqldiff --git a/store/migration/sqlite/prod/0.16/00__add_memo_id_to_resource.sql b/store/migration/sqlite/0.16/00__add_memo_id_to_resource.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.16/00__add_memo_id_to_resource.sqlrename to store/migration/sqlite/0.16/00__add_memo_id_to_resource.sqldiff --git a/store/migration/sqlite/prod/0.16/01__drop_shortcut_table.sql b/store/migration/sqlite/0.16/01__drop_shortcut_table.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.16/01__drop_shortcut_table.sqlrename to store/migration/sqlite/0.16/01__drop_shortcut_table.sqldiff --git a/store/migration/sqlite/prod/0.17/00__inbox.sql b/store/migration/sqlite/0.17/00__inbox.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.17/00__inbox.sqlrename to store/migration/sqlite/0.17/00__inbox.sqldiff --git a/store/migration/sqlite/prod/0.17/01__delete_activities.sql b/store/migration/sqlite/0.17/01__delete_activities.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.17/01__delete_activities.sqlrename to store/migration/sqlite/0.17/01__delete_activities.sqldiff --git a/store/migration/sqlite/prod/0.18/00__webhook.sql b/store/migration/sqlite/0.18/00__webhook.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.18/00__webhook.sqlrename to store/migration/sqlite/0.18/00__webhook.sqldiff --git a/store/migration/sqlite/prod/0.18/01__user_setting.sql b/store/migration/sqlite/0.18/01__user_setting.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.18/01__user_setting.sqlrename to store/migration/sqlite/0.18/01__user_setting.sqldiff --git a/store/migration/sqlite/prod/0.19/00__add_resource_name.sql b/store/migration/sqlite/0.19/00__add_resource_name.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.19/00__add_resource_name.sqlrename to store/migration/sqlite/0.19/00__add_resource_name.sqldiff --git a/store/migration/sqlite/prod/0.2/00__user_role.sql b/store/migration/sqlite/0.2/00__user_role.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.2/00__user_role.sqlrename to store/migration/sqlite/0.2/00__user_role.sqldiff --git a/store/migration/sqlite/prod/0.2/01__memo_visibility.sql b/store/migration/sqlite/0.2/01__memo_visibility.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.2/01__memo_visibility.sqlrename to store/migration/sqlite/0.2/01__memo_visibility.sqldiff --git a/store/migration/sqlite/prod/0.20/00__reaction.sql b/store/migration/sqlite/0.20/00__reaction.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.20/00__reaction.sqlrename to store/migration/sqlite/0.20/00__reaction.sqldiff --git a/store/migration/sqlite/prod/0.21/00__user_description.sql b/store/migration/sqlite/0.21/00__user_description.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.21/00__user_description.sqlrename to store/migration/sqlite/0.21/00__user_description.sqldiff --git a/store/migration/sqlite/prod/0.21/01__rename_uid.sql b/store/migration/sqlite/0.21/01__rename_uid.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.21/01__rename_uid.sqlrename to store/migration/sqlite/0.21/01__rename_uid.sqldiff --git a/store/migration/sqlite/prod/0.22/00__resource_storage_type.sql b/store/migration/sqlite/0.22/00__resource_storage_type.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.22/00__resource_storage_type.sqlrename to store/migration/sqlite/0.22/00__resource_storage_type.sqldiff --git a/store/migration/sqlite/prod/0.22/01__memo_tags.sql b/store/migration/sqlite/0.22/01__memo_tags.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.22/01__memo_tags.sqlrename to store/migration/sqlite/0.22/01__memo_tags.sqldiff --git a/store/migration/sqlite/prod/0.22/02__memo_payload.sql b/store/migration/sqlite/0.22/02__memo_payload.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.22/02__memo_payload.sqlrename to store/migration/sqlite/0.22/02__memo_payload.sqldiff --git a/store/migration/sqlite/prod/0.22/03__drop_tag.sql b/store/migration/sqlite/0.22/03__drop_tag.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.22/03__drop_tag.sqlrename to store/migration/sqlite/0.22/03__drop_tag.sqldiff --git a/store/migration/sqlite/prod/0.23/00__reactions.sql b/store/migration/sqlite/0.23/00__reactions.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.23/00__reactions.sqlrename to store/migration/sqlite/0.23/00__reactions.sqldiff --git a/store/migration/sqlite/0.24/00__memo.sql b/store/migration/sqlite/0.24/00__memo.sqlnew file mode 100644index 000000000..9351e4cd3--- /dev/null+++ b/store/migration/sqlite/0.24/00__memo.sql@@ -0,0 +1,15 @@+-- Drop deprecated tags column.+ALTER TABLE memo DROP COLUMN tags;++-- Remove deprecated indexes.+DROP INDEX IF EXISTS idx_memo_tags;+DROP INDEX IF EXISTS idx_memo_content;+DROP INDEX IF EXISTS idx_memo_visibility;++-- Add pinned column.+ALTER TABLE memo ADD COLUMN pinned INTEGER NOT NULL CHECK (pinned IN (0, 1)) DEFAULT 0;++-- Update pinned column from memo_organizer.+UPDATE memo+SET pinned = 1+WHERE EXISTS (SELECT 1 FROM memo_organizer WHERE memo_organizer.memo_id = memo.id AND memo_organizer.pinned = 1);diff --git a/store/migration/sqlite/prod/0.3/00__memo_visibility_protected.sql b/store/migration/sqlite/0.3/00__memo_visibility_protected.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.3/00__memo_visibility_protected.sqlrename to store/migration/sqlite/0.3/00__memo_visibility_protected.sqldiff --git a/store/migration/sqlite/prod/0.4/00__user_setting.sql b/store/migration/sqlite/0.4/00__user_setting.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.4/00__user_setting.sqlrename to store/migration/sqlite/0.4/00__user_setting.sqldiff --git a/store/migration/sqlite/prod/0.5/00__regenerate_foreign_keys.sql b/store/migration/sqlite/0.5/00__regenerate_foreign_keys.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.5/00__regenerate_foreign_keys.sqlrename to store/migration/sqlite/0.5/00__regenerate_foreign_keys.sqldiff --git a/store/migration/sqlite/prod/0.5/01__memo_resource.sql b/store/migration/sqlite/0.5/01__memo_resource.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.5/01__memo_resource.sqlrename to store/migration/sqlite/0.5/01__memo_resource.sqldiff --git a/store/migration/sqlite/prod/0.5/02__system_setting.sql b/store/migration/sqlite/0.5/02__system_setting.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.5/02__system_setting.sqlrename to store/migration/sqlite/0.5/02__system_setting.sqldiff --git a/store/migration/sqlite/prod/0.5/03__resource_extermal_link.sql b/store/migration/sqlite/0.5/03__resource_extermal_link.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.5/03__resource_extermal_link.sqlrename to store/migration/sqlite/0.5/03__resource_extermal_link.sqldiff --git a/store/migration/sqlite/prod/0.6/00__recreate_triggers.sql b/store/migration/sqlite/0.6/00__recreate_triggers.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.6/00__recreate_triggers.sqlrename to store/migration/sqlite/0.6/00__recreate_triggers.sqldiff --git a/store/migration/sqlite/prod/0.7/00__remove_fk.sql b/store/migration/sqlite/0.7/00__remove_fk.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.7/00__remove_fk.sqlrename to store/migration/sqlite/0.7/00__remove_fk.sqldiff --git a/store/migration/sqlite/prod/0.7/01__remove_triggers.sql b/store/migration/sqlite/0.7/01__remove_triggers.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.7/01__remove_triggers.sqlrename to store/migration/sqlite/0.7/01__remove_triggers.sqldiff --git a/store/migration/sqlite/prod/0.8/00__migration_history.sql b/store/migration/sqlite/0.8/00__migration_history.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.8/00__migration_history.sqlrename to store/migration/sqlite/0.8/00__migration_history.sqldiff --git a/store/migration/sqlite/prod/0.8/01__user_username.sql b/store/migration/sqlite/0.8/01__user_username.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.8/01__user_username.sqlrename to store/migration/sqlite/0.8/01__user_username.sqldiff --git a/store/migration/sqlite/prod/0.9/00__tag.sql b/store/migration/sqlite/0.9/00__tag.sqlsimilarity index 100%rename from store/migration/sqlite/prod/0.9/00__tag.sqlrename to store/migration/sqlite/0.9/00__tag.sqldiff --git a/store/migration/sqlite/prod/LATEST.sql b/store/migration/sqlite/LATEST.sqlsimilarity index 95%rename from store/migration/sqlite/prod/LATEST.sqlrename to store/migration/sqlite/LATEST.sqlindex 8052de8c8..0fe39cc42 100644--- a/store/migration/sqlite/prod/LATEST.sql+++ b/store/migration/sqlite/LATEST.sql@@ -47,14 +47,11 @@ CREATE TABLE memo (row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL',content TEXT NOT NULL DEFAULT '',visibility TEXT NOT NULL CHECK (visibility IN ('PUBLIC', 'PROTECTED', 'PRIVATE')) DEFAULT 'PRIVATE',- tags TEXT NOT NULL DEFAULT '[]',+ pinned INTEGER NOT NULL CHECK (pinned IN (0, 1)) DEFAULT 0,payload TEXT NOT NULL DEFAULT '{}');CREATE INDEX idx_memo_creator_id ON memo (creator_id);-CREATE INDEX idx_memo_content ON memo (content);-CREATE INDEX idx_memo_visibility ON memo (visibility);-CREATE INDEX idx_memo_tags ON memo (tags);-- memo_organizerCREATE TABLE memo_organizer (diff --git a/store/migration/sqlite/dev/LATEST.sql b/store/migration/sqlite/dev/LATEST.sqldeleted file mode 100644index 42932b88f..000000000--- a/store/migration/sqlite/dev/LATEST.sql+++ /dev/null@@ -1,135 +0,0 @@--- migration_history-CREATE TABLE migration_history (- version TEXT NOT NULL PRIMARY KEY,- created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now'))-);---- system_setting-CREATE TABLE system_setting (- name TEXT NOT NULL,- value TEXT NOT NULL,- description TEXT NOT NULL DEFAULT '',- UNIQUE(name)-);---- user-CREATE TABLE user (- id INTEGER PRIMARY KEY AUTOINCREMENT,- created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL',- username TEXT NOT NULL UNIQUE,- role TEXT NOT NULL CHECK (role IN ('HOST', 'ADMIN', 'USER')) DEFAULT 'USER',- email TEXT NOT NULL DEFAULT '',- nickname TEXT NOT NULL DEFAULT '',- password_hash TEXT NOT NULL,- avatar_url TEXT NOT NULL DEFAULT '',- description TEXT NOT NULL DEFAULT ''-);--CREATE INDEX idx_user_username ON user (username);---- user_setting-CREATE TABLE user_setting (- user_id INTEGER NOT NULL,- key TEXT NOT NULL,- value TEXT NOT NULL,- UNIQUE(user_id, key)-);---- memo-CREATE TABLE memo (- id INTEGER PRIMARY KEY AUTOINCREMENT,- uid TEXT NOT NULL UNIQUE,- creator_id INTEGER NOT NULL,- created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL',- content TEXT NOT NULL DEFAULT '',- visibility TEXT NOT NULL CHECK (visibility IN ('PUBLIC', 'PROTECTED', 'PRIVATE')) DEFAULT 'PRIVATE',- pinned INTEGER NOT NULL CHECK (pinned IN (0, 1)) DEFAULT 0,- payload TEXT NOT NULL DEFAULT '{}'-);--CREATE INDEX idx_memo_creator_id ON memo (creator_id);---- memo_relation-CREATE TABLE memo_relation (- memo_id INTEGER NOT NULL,- related_memo_id INTEGER NOT NULL,- type TEXT NOT NULL,- UNIQUE(memo_id, related_memo_id, type)-);---- resource-CREATE TABLE resource (- id INTEGER PRIMARY KEY AUTOINCREMENT,- uid TEXT NOT NULL UNIQUE,- creator_id INTEGER NOT NULL,- created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- filename TEXT NOT NULL DEFAULT '',- blob BLOB DEFAULT NULL,- type TEXT NOT NULL DEFAULT '',- size INTEGER NOT NULL DEFAULT 0,- memo_id INTEGER,- storage_type TEXT NOT NULL DEFAULT '',- reference TEXT NOT NULL DEFAULT '',- payload TEXT NOT NULL DEFAULT '{}'-);--CREATE INDEX idx_resource_creator_id ON resource (creator_id);--CREATE INDEX idx_resource_memo_id ON resource (memo_id);---- activity-CREATE TABLE activity (- id INTEGER PRIMARY KEY AUTOINCREMENT,- creator_id INTEGER NOT NULL,- created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- type TEXT NOT NULL DEFAULT '',- level TEXT NOT NULL CHECK (level IN ('INFO', 'WARN', 'ERROR')) DEFAULT 'INFO',- payload TEXT NOT NULL DEFAULT '{}'-);---- idp-CREATE TABLE idp (- id INTEGER PRIMARY KEY AUTOINCREMENT,- name TEXT NOT NULL,- type TEXT NOT NULL,- identifier_filter TEXT NOT NULL DEFAULT '',- config TEXT NOT NULL DEFAULT '{}'-);---- inbox-CREATE TABLE inbox (- id INTEGER PRIMARY KEY AUTOINCREMENT,- created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- sender_id INTEGER NOT NULL,- receiver_id INTEGER NOT NULL,- status TEXT NOT NULL,- message TEXT NOT NULL DEFAULT '{}'-);---- webhook-CREATE TABLE webhook (- id INTEGER PRIMARY KEY AUTOINCREMENT,- created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL',- creator_id INTEGER NOT NULL,- name TEXT NOT NULL,- url TEXT NOT NULL-);--CREATE INDEX idx_webhook_creator_id ON webhook (creator_id);---- reaction-CREATE TABLE reaction (- id INTEGER PRIMARY KEY AUTOINCREMENT,- created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- creator_id INTEGER NOT NULL,- content_id TEXT NOT NULL,- reaction_type TEXT NOT NULL,- UNIQUE(creator_id, content_id, reaction_type)-);diff --git a/store/migration/sqlite/prod/0.24/00__memo_tags.sql b/store/migration/sqlite/prod/0.24/00__memo_tags.sqldeleted file mode 100644index ed5bbc021..000000000--- a/store/migration/sqlite/prod/0.24/00__memo_tags.sql+++ /dev/null@@ -1,4 +0,0 @@--- Drop deprecated tags column.-ALTER TABLE memo DROP COLUMN tags;--DROP INDEX IF EXISTS idx_memo_tags;diff --git a/store/migrator.go b/store/migrator.goindex 7ac5445e5..2469e55cf 100644--- a/store/migrator.go+++ b/store/migrator.go@@ -166,11 +166,7 @@ func (s *Store) preMigrate(ctx context.Context) error {}func (s *Store) getMigrationBasePath() string {- mode := "dev"- if s.Profile.Mode == "prod" {- mode = "prod"- }- return fmt.Sprintf("migration/%s/%s/", s.Profile.Driver, mode)+ return fmt.Sprintf("migration/%s/", s.Profile.Driver)}func (s *Store) getSeedBasePath() string {