refactor: update db migrator

This commit is contained in:
Steven
2024-08-29 08:21:23 +08:00
parent 784d91ab75
commit 85f5f03be9
19 changed files with 307 additions and 412 deletions

View File

@ -0,0 +1,34 @@
INSERT INTO
user (
`id`,
`role`,
`email`,
`nickname`,
`password_hash`
)
VALUES
(
101,
'ADMIN',
'slash@yourselfhosted.com',
'Slasher',
'$2a$10$H8HBWGcG/hoePhFy5SiNKOHxMD6omIpyEEWbl/fIorFC814bXW.Ua'
);
INSERT INTO
user (
`id`,
`role`,
`email`,
`nickname`,
`password_hash`
)
VALUES
(
102,
'USER',
'steven@yourselfhosted.com',
'Steven',
-- raw password: secret
'$2a$14$ajq8Q7fbtFRQvXpdCq7Jcuy.Rx1h/L4J60Otx.gyNLbAYctGMJ9tK'
);

View File

@ -0,0 +1,94 @@
INSERT INTO
shortcut (
`id`,
`creator_id`,
`name`,
`link`,
`visibility`
)
VALUES
(
1,
101,
'discord',
'https://discord.gg/QZqUuUAhDV',
'PUBLIC'
);
INSERT INTO
shortcut (
`id`,
`creator_id`,
`name`,
`link`,
`visibility`,
`tag`,
`og_metadata`
)
VALUES
(
2,
101,
'ai-infra',
'https://star-history.com/blog/open-source-ai-infra-projects',
'PUBLIC',
'star-history ai',
'{"title":"Open Source AI Infra for Your Next Project","description":"Some open-source infra projects that can be directly used for your next project. 💡","image":"https://star-history.com/blog/assets/open-source-ai-infra-projects/banner.webp"}'
);
INSERT INTO
shortcut (
`id`,
`creator_id`,
`name`,
`link`,
`visibility`,
`tag`,
`og_metadata`
)
VALUES
(
3,
101,
'schema-change',
'https://www.bytebase.com/blog/how-to-handle-database-schema-change/#what-is-a-database-schema-change',
'PUBLIC',
'database article👍',
'{"title":"How to Handle Database Migration / Schema Change?","description":"A database schema is the structure of a database, which describes the relationships between the different tables and fields in the database. A database schema change, also known as schema migration, or simply migration refers to any alteration to this structure, such as adding a new table, modifying the data type of a field, or changing the relationships between tables.","image":"https://www.bytebase.com/_next/image/?url=%2Fcontent%2Fblog%2Fhow-to-handle-database-schema-change%2Fchange.webp\u0026w=2048\u0026q=75"}'
);
INSERT INTO
shortcut (
`id`,
`creator_id`,
`name`,
`link`,
`tag`,
`visibility`
)
VALUES
(
4,
101,
'sqlchat',
'https://www.sqlchat.ai',
'ai chatbot sql',
'WORKSPACE'
);
INSERT INTO
shortcut (
`id`,
`creator_id`,
`name`,
`link`,
`visibility`
)
VALUES
(
5,
102,
'stevenlgtm',
'https://github.com/boojack',
'PUBLIC'
);

View File

@ -0,0 +1,20 @@
INSERT INTO
collection (
`id`,
`creator_id`,
`name`,
`title`,
`description`,
`visibility`,
`shortcut_ids`
)
VALUES
(
1,
101,
'minecraft',
'Minecraft',
'My daily thoughts and ideas',
'PUBLIC',
'1,2,3,4,5'
);