-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(database): implement database migrations
- Loading branch information
Showing
7 changed files
with
101 additions
and
114 deletions.
There are no files selected for viewing
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
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,7 @@ | ||
DROP TABLE IF EXISTS hm_user; | ||
|
||
CREATE TABLE IF NOT EXISTS hm_user ( | ||
username VARCHAR(255), | ||
hash VARCHAR(255), | ||
PRIMARY KEY (username) | ||
); |
8 changes: 8 additions & 0 deletions
8
database/migrations/20241209010200_create_hm_user_session_table.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,8 @@ | ||
DROP TABLE IF EXISTS hm_user_session; | ||
|
||
CREATE TABLE IF NOT EXISTS hm_user_session ( | ||
hm_id VARCHAR(255), | ||
data LONGBLOB, | ||
date TIMESTAMP, | ||
PRIMARY KEY (hm_id) | ||
); |
7 changes: 7 additions & 0 deletions
7
database/migrations/20241209010300_create_hm_user_settings_table.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,7 @@ | ||
DROP TABLE IF EXISTS hm_user_settings; | ||
|
||
CREATE TABLE IF NOT EXISTS hm_user_settings ( | ||
username VARCHAR(255), | ||
settings LONGBLOB, | ||
PRIMARY KEY (username) | ||
); |
1 change: 1 addition & 0 deletions
1
database/migrations/20241209040200_add_hm_version_to_hm_user_session_table.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 @@ | ||
ALTER TABLE hm_user_session ADD COLUMN hm_version INT DEFAULT 1; |
7 changes: 7 additions & 0 deletions
7
database/migrations/20241209040300_add_lock_to_hm_user_session_table.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,7 @@ | ||
PRAGMA foreign_keys=off; | ||
CREATE TEMPORARY TABLE hm_user_session_new AS | ||
SELECT *, NULL AS lock FROM hm_user_session; | ||
|
||
DROP TABLE hm_user_session; | ||
ALTER TABLE hm_user_session_new RENAME TO hm_user_session; | ||
PRAGMA foreign_keys=on; |
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