-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(migration): refactor migration process
- Loading branch information
Showing
20 changed files
with
80 additions
and
133 deletions.
There are no files selected for viewing
7 changes: 0 additions & 7 deletions
7
database/migrations/mysql/20241209010100_create_hm_user_table.sql
This file was deleted.
Oops, something went wrong.
File renamed without changes.
8 changes: 0 additions & 8 deletions
8
database/migrations/mysql/20241209010200_create_hm_user_session_table.sql
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
database/migrations/mysql/20241209010300_create_hm_user_settings_table.sql
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
database/migrations/pgsql/20241209010100_create_hm_user_table.sql
This file was deleted.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
database/migrations/pgsql/20241209010200_add_hm_version_columns.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE hm_user_session | ||
ADD COLUMN hm_version INT DEFAULT 1; |
13 changes: 0 additions & 13 deletions
13
database/migrations/pgsql/20241209010200_create_hm_user_session_table.sql
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
database/migrations/pgsql/20241209010300_create_hm_user_settings_table.sql
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
database/migrations/pgsql/20241209040200_add_hm_version_to_hm_user_session_table.sql
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
database/migrations/sqlite/20241209010100_create_hm_user_table.sql
This file was deleted.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
database/migrations/sqlite/20241209010200_add_hm_version_columns.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE hm_user_session | ||
ADD COLUMN hm_version INT DEFAULT 1; |
9 changes: 0 additions & 9 deletions
9
database/migrations/sqlite/20241209010200_create_hm_user_session_table.sql
This file was deleted.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
database/migrations/sqlite/20241209010201_add_lock_columns.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE hm_user_session | ||
ADD COLUMN lock INT DEFAULT 0; |
7 changes: 0 additions & 7 deletions
7
database/migrations/sqlite/20241209010300_create_hm_user_settings_table.sql
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
database/migrations/sqlite/20241209040200_add_hm_version_to_hm_user_session_table.sql
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
database/migrations/sqlite/20241209040300_add_lock_to_hm_user_session_table.sql
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
CREATE TABLE IF NOT EXISTS hm_user ( | ||
username VARCHAR(255), | ||
hash VARCHAR(255), | ||
PRIMARY KEY (username) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS hm_user_session ( | ||
hm_id VARCHAR(255), | ||
data LONGBLOB, | ||
date TIMESTAMP, | ||
hm_version INT DEFAULT 1, | ||
PRIMARY KEY (hm_id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS hm_user_settings ( | ||
username VARCHAR(255), | ||
settings LONGBLOB, | ||
PRIMARY KEY (username) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
DO $$ | ||
BEGIN | ||
IF NOT EXISTS (SELECT 1 FROM information_schema.tables | ||
WHERE table_name = 'hm_user') THEN | ||
CREATE TABLE hm_user ( | ||
username VARCHAR(255) PRIMARY KEY, | ||
hash VARCHAR(255) | ||
); | ||
END IF; | ||
END $$; | ||
|
||
DO $$ | ||
BEGIN | ||
IF NOT EXISTS (SELECT 1 FROM information_schema.tables | ||
WHERE table_name = 'hm_user_session') THEN | ||
CREATE TABLE hm_user_session ( | ||
hm_id VARCHAR(255) PRIMARY KEY, | ||
data BYTEA, | ||
date TIMESTAMP, | ||
hm_version INT DEFAULT 1 | ||
); | ||
END IF; | ||
END $$; | ||
|
||
DO $$ | ||
BEGIN | ||
IF NOT EXISTS (SELECT 1 FROM information_schema.tables | ||
WHERE table_name = 'hm_user_settings') THEN | ||
CREATE TABLE hm_user_settings ( | ||
username VARCHAR(255) PRIMARY KEY, | ||
settings BYTEA | ||
); | ||
END IF; | ||
END $$; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
CREATE TABLE IF NOT EXISTS hm_user ( | ||
username TEXT NOT NULL, | ||
hash TEXT NOT NULL, | ||
PRIMARY KEY (username) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS hm_user_session ( | ||
hm_id TEXT NOT NULL, | ||
data BLOB, | ||
date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
hm_version INT DEFAULT 1, | ||
lock INT DEFAULT 0, | ||
PRIMARY KEY (hm_id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS hm_user_settings ( | ||
username TEXT NOT NULL, | ||
settings BLOB, | ||
PRIMARY KEY (username) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters