mirror of
https://github.com/logto-io/logto.git
synced 2025-03-31 22:51:25 -05:00
chore(schemas): add custom phrases database alteration script (#2016)
This commit is contained in:
parent
5bd54484b4
commit
df18d87103
2 changed files with 24 additions and 5 deletions
|
@ -1,9 +1,6 @@
|
|||
import { DatabasePool, sql } from 'slonik';
|
||||
import { sql } from 'slonik';
|
||||
|
||||
export type AlterationScript = {
|
||||
up: (pool: DatabasePool) => Promise<void>;
|
||||
down: (pool: DatabasePool) => Promise<void>;
|
||||
};
|
||||
import { AlterationScript } from '../lib/types/alteration';
|
||||
|
||||
const alteration: AlterationScript = {
|
||||
up: async (pool) => {
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
import { sql } from 'slonik';
|
||||
|
||||
import { AlterationScript } from '../lib/types/alteration';
|
||||
|
||||
const alteration: AlterationScript = {
|
||||
up: async (pool) => {
|
||||
// [Pull] feat(core,schemas): add phrases schema and GET /custom-phrases/:languageKey route #1905
|
||||
await pool.query(sql`
|
||||
create table custom_phrases (
|
||||
language_key varchar(16) not null,
|
||||
translation jsonb not null,
|
||||
primary key(language_key)
|
||||
);
|
||||
`);
|
||||
},
|
||||
down: async (pool) => {
|
||||
// [Pull] feat(core,schemas): add phrases schema and GET /custom-phrases/:languageKey route #1905
|
||||
await pool.query(sql`drop table custom_phrases;`);
|
||||
},
|
||||
};
|
||||
|
||||
export default alteration;
|
Loading…
Add table
Reference in a new issue