2023-01-27 23:29:47 -05:00
|
|
|
import { sql } from 'slonik';
|
|
|
|
|
|
|
|
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
|
|
|
|
|
|
const alteration: AlterationScript = {
|
|
|
|
up: async (pool) => {
|
|
|
|
await pool.query(sql`
|
|
|
|
alter table oidc_model_instances
|
|
|
|
drop constraint oidc_model_instances_pkey,
|
2023-01-28 06:26:29 -05:00
|
|
|
add primary key (id),
|
|
|
|
add constraint oidc_model_instances__model_name_id
|
|
|
|
unique (model_name, id);
|
2023-01-27 23:29:47 -05:00
|
|
|
`);
|
|
|
|
},
|
|
|
|
down: async (pool) => {
|
|
|
|
await pool.query(sql`
|
|
|
|
alter table oidc_model_instances
|
|
|
|
drop constraint oidc_model_instances_pkey,
|
2023-01-28 06:26:29 -05:00
|
|
|
drop constraint oidc_model_instances__model_name_id,
|
2023-01-27 23:29:47 -05:00
|
|
|
add primary key (model_name, id);
|
|
|
|
`);
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export default alteration;
|