0
Fork 0
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:
IceHe 2022-09-27 17:15:56 +08:00 committed by GitHub
parent 5bd54484b4
commit df18d87103
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 5 deletions

View file

@ -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) => {

View file

@ -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;