( sn: SqliteSchema, action?: 'push' | undefined, casing?: CasingType | undefined, )
| 2112 | }; |
| 2113 | |
| 2114 | export const applyLibSQLDiffs = async ( |
| 2115 | sn: SqliteSchema, |
| 2116 | action?: 'push' | undefined, |
| 2117 | casing?: CasingType | undefined, |
| 2118 | ) => { |
| 2119 | const dryRun = { |
| 2120 | version: '6', |
| 2121 | dialect: 'sqlite', |
| 2122 | id: '0', |
| 2123 | prevId: '0', |
| 2124 | tables: {}, |
| 2125 | views: {}, |
| 2126 | enums: {}, |
| 2127 | schemas: {}, |
| 2128 | _meta: { |
| 2129 | schemas: {}, |
| 2130 | tables: {}, |
| 2131 | columns: {}, |
| 2132 | }, |
| 2133 | } as const; |
| 2134 | |
| 2135 | const tables = Object.values(sn).filter((it) => is(it, SQLiteTable)) as SQLiteTable[]; |
| 2136 | |
| 2137 | const views = Object.values(sn).filter((it) => is(it, SQLiteView)) as SQLiteView[]; |
| 2138 | |
| 2139 | const serialized1 = generateSqliteSnapshot(tables, views, casing); |
| 2140 | |
| 2141 | const { version: v1, dialect: d1, ...rest1 } = serialized1; |
| 2142 | |
| 2143 | const sch1 = { |
| 2144 | version: '6', |
| 2145 | dialect: 'sqlite', |
| 2146 | id: '0', |
| 2147 | prevId: '0', |
| 2148 | ...rest1, |
| 2149 | } as const; |
| 2150 | |
| 2151 | const sn1 = squashSqliteScheme(sch1, action); |
| 2152 | |
| 2153 | const { sqlStatements, statements } = await applyLibSQLSnapshotsDiff( |
| 2154 | dryRun, |
| 2155 | sn1, |
| 2156 | testTablesResolver(new Set()), |
| 2157 | testColumnsResolver(new Set()), |
| 2158 | testViewsResolverSqlite(new Set()), |
| 2159 | dryRun, |
| 2160 | sch1, |
| 2161 | action, |
| 2162 | ); |
| 2163 | |
| 2164 | return { sqlStatements, statements }; |
| 2165 | }; |
| 2166 | |
| 2167 | export const diffTestSchemasSqlite = async ( |
| 2168 | left: SqliteSchema, |
no test coverage detected