( schemaName: string, schema: DatabaseTableSchema )
| 24 | } |
| 25 | |
| 26 | export function createTableSchemaDraft( |
| 27 | schemaName: string, |
| 28 | schema: DatabaseTableSchema |
| 29 | ): DatabaseTableSchemaChange { |
| 30 | return { |
| 31 | schemaName, |
| 32 | name: { |
| 33 | old: schema.tableName, |
| 34 | new: schema.tableName, |
| 35 | }, |
| 36 | columns: schema.columns.map((col) => ({ |
| 37 | key: generateId(), |
| 38 | old: col, |
| 39 | new: cloneDeep(col), |
| 40 | })), |
| 41 | constraints: (schema.constraints ?? []).map((con) => ({ |
| 42 | id: generateId(), |
| 43 | old: con, |
| 44 | new: cloneDeep(con), |
| 45 | })), |
| 46 | createScript: schema.createScript, |
| 47 | }; |
| 48 | } |
searching dependent graphs…