Repository navigation
Commit 0d3183f
committed
Fix postgres and CockroachDB diff cases that write failing SQL around moves, renames, roles and generated columns
Postgres:
- Count the brackets of a custom type's SQL type as array dimensions.
- Drop and create the foreign keys of a recreated generated column one
time each, and create its indexes and unique constraints one time.
- Rename a view in its old schema before it moves, and move it with its
old kind.
- Drop a recreated view after its rename or move.
- Run the policy drops, foreign key drops and row level security
statements of a moved table after `SET SCHEMA`.
- Run `DROP ROLE` after the policy statements.
- Run `DROP EXPRESSION` first and write no `USING` clause for a
generated column.
- Find the enum columns that a format 7 snapshot stores without a type
schema when the enum is recreated, with the s06 tests and fixtures.
CockroachDB:
- Drop a view that reads a renamed or moved table before the table
statement and create it after it. Replace `recreate_view` with a
`drop_view` that has a `cause`, in the diff, in push and in
`cockroachExplain`.
- Write both statements for a view or a sequence that moves and gets a
new name, and look up the old view of a moved view that is recreated.
- Name the table in an index rename or drop when two tables hold the
index name.
- Write `RENAME CONSTRAINT` for a check rename.
- Select the row of the renamed check, index, primary key, foreign key
or policy by its table.
- Change the column type when only the type schema or the array
dimensions change, and count the brackets of a custom type's SQL type.
- Run table renames and moves before the statements that name the table
in its new place.
- Create the foreign keys of a recreated generated column again.
- Run `DROP ROLE` after the policy statements.1 parent cca6ce3 commit 0d3183f
28 files changed
Lines changed: 1853 additions & 131 deletions
File tree
- drizzle-kit
- src
- cli
- commands
- dialects
- cockroach
- postgres
- tests
- cockroach
- postgres
- snapshots
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
510 | | - | |
511 | | - | |
| 510 | + | |
| 511 | + | |
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | 65 | | |
72 | 66 | | |
73 | 67 | | |
| |||
245 | 239 | | |
246 | 240 | | |
247 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
248 | 246 | | |
249 | | - | |
| 247 | + | |
250 | 248 | | |
251 | 249 | | |
252 | 250 | | |
253 | 251 | | |
254 | | - | |
| 252 | + | |
255 | 253 | | |
256 | 254 | | |
257 | 255 | | |
258 | 256 | | |
| 257 | + | |
| 258 | + | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
262 | | - | |
| 261 | + | |
| 262 | + | |
263 | 263 | | |
264 | | - | |
265 | | - | |
| 264 | + | |
| 265 | + | |
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
| 390 | + | |
390 | 391 | | |
391 | | - | |
| 392 | + | |
392 | 393 | | |
393 | 394 | | |
394 | 395 | | |
395 | 396 | | |
396 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
397 | 400 | | |
398 | 401 | | |
399 | 402 | | |
400 | 403 | | |
401 | 404 | | |
402 | | - | |
| 405 | + | |
| 406 | + | |
403 | 407 | | |
404 | | - | |
| 408 | + | |
405 | 409 | | |
406 | 410 | | |
407 | 411 | | |
| |||
723 | 727 | | |
724 | 728 | | |
725 | 729 | | |
726 | | - | |
727 | 730 | | |
728 | 731 | | |
729 | 732 | | |
| |||
0 commit comments