( sn: PostgresSchema, casing: CasingType | undefined, )
| 1128 | }; |
| 1129 | |
| 1130 | export const applyPgDiffs = async ( |
| 1131 | sn: PostgresSchema, |
| 1132 | casing: CasingType | undefined, |
| 1133 | ) => { |
| 1134 | const dryRun = { |
| 1135 | version: '7', |
| 1136 | dialect: 'postgresql', |
| 1137 | id: '0', |
| 1138 | prevId: '0', |
| 1139 | tables: {}, |
| 1140 | enums: {}, |
| 1141 | views: {}, |
| 1142 | schemas: {}, |
| 1143 | sequences: {}, |
| 1144 | policies: {}, |
| 1145 | roles: {}, |
| 1146 | _meta: { |
| 1147 | schemas: {}, |
| 1148 | tables: {}, |
| 1149 | columns: {}, |
| 1150 | }, |
| 1151 | } as const; |
| 1152 | |
| 1153 | const tables = Object.values(sn).filter((it) => is(it, PgTable)) as PgTable[]; |
| 1154 | |
| 1155 | const schemas = Object.values(sn).filter((it) => is(it, PgSchema)) as PgSchema[]; |
| 1156 | |
| 1157 | const enums = Object.values(sn).filter((it) => isPgEnum(it)) as PgEnum<any>[]; |
| 1158 | |
| 1159 | const sequences = Object.values(sn).filter((it) => isPgSequence(it)) as PgSequence[]; |
| 1160 | |
| 1161 | const roles = Object.values(sn).filter((it) => is(it, PgRole)) as PgRole[]; |
| 1162 | |
| 1163 | const views = Object.values(sn).filter((it) => isPgView(it)) as PgView[]; |
| 1164 | |
| 1165 | const policies = Object.values(sn).filter((it) => is(it, PgPolicy)) as PgPolicy[]; |
| 1166 | |
| 1167 | const materializedViews = Object.values(sn).filter((it) => isPgMaterializedView(it)) as PgMaterializedView[]; |
| 1168 | |
| 1169 | const serialized1 = generatePgSnapshot( |
| 1170 | tables, |
| 1171 | enums, |
| 1172 | schemas, |
| 1173 | sequences, |
| 1174 | roles, |
| 1175 | policies, |
| 1176 | views, |
| 1177 | materializedViews, |
| 1178 | casing, |
| 1179 | ); |
| 1180 | |
| 1181 | const { version: v1, dialect: d1, ...rest1 } = serialized1; |
| 1182 | |
| 1183 | const sch1 = { |
| 1184 | version: '7', |
| 1185 | dialect: 'postgresql', |
| 1186 | id: '0', |
| 1187 | prevId: '0', |
no test coverage detected