You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> If you were already using SQLite in any `beta.x` version and have used the `drizzle-kit up` command, you will not receive the latest `up` changes from this release. If you are unable to reset migrations and start from scratch, you will need to contact us for support with upgrading
12
+
13
+
### What was changed?
14
+
15
+
#### Handling of UNIQUE constraints in SQLite
16
+
17
+
In the new version `drizzle-kit` handles `UNIQUE` constraints. This decision was made because when a unique constraint is created it cannot be removed, whereas an index can be dropped
18
+
19
+
Previous version of Drizzle-Kit always created `.unique()` as a `uniqueIndex` and stored it in the snapshot that way. Because of this during an up we lack of sufficient information and if a user used `.unique()` an upped will generate a diff on generate and push
20
+
21
+
**Solution:**
22
+
23
+
We are replacing all unique constraints with `uniqueIndex`
24
+
25
+
`uniqueIndex` requires a name and the name must follow this format:
26
+
27
+
`<table>_<column1>*_*<column2>_..._unique`
28
+
29
+
#### Foreign key name handling in the old(pre 1.0) drizzle-kit
30
+
31
+
The old `drizzle-kit` did not handle foreign key names when generated sql migrations. A foreign key name could be defined in the ts schema, but it was not passed through when generating sql
On `introspect` new drizzle-kit parses ddl to find constraint name, if no name found - use default name
51
+
52
+
After running `drizzle-kit up` the first `push` command will result in a diff that recreates the table (no name from db, but there is name in ts schema). To avoid this foreign key names should be removed - in that case no diff will be generated.
53
+
54
+
`drizzle-kit generate` command will behave as expected, no changes needed.
55
+
56
+
#### Bug in the old drizzle-kit related to foreign keys
57
+
58
+
If you add a column to an existing table that has a foreign key and specify `onDelete` or `onUpdate`, column will be added with the foreign key, but without those parameters
There is no way to fix this in the old snapshot. It leads to persistent diffs during `push` with old Drizzle-Kit.
78
+
79
+
New `drizzle-kit` will recreate table after push command with the correct SQL. When using `generate` command, no diffs will appear, but the actual database state may differ
> If you were already using SQLite in any `beta.x` version and have used the `drizzle-kit up` command, you will not receive the latest `up` changes from this release. If you are unable to reset migrations and start from scratch, you will need to contact us for support with upgrading
12
+
13
+
### What was changed?
14
+
15
+
#### Handling of UNIQUE constraints in SQLite
16
+
17
+
In the new version `drizzle-kit` handles `UNIQUE` constraints. This decision was made because when a unique constraint is created it cannot be removed, whereas an index can be dropped
18
+
19
+
Previous version of Drizzle-Kit always created `.unique()` as a `uniqueIndex` and stored it in the snapshot that way. Because of this during an up we lack of sufficient information and if a user used `.unique()` an upped will generate a diff on generate and push
20
+
21
+
**Solution:**
22
+
23
+
We are replacing all unique constraints with `uniqueIndex`
24
+
25
+
`uniqueIndex` requires a name and the name must follow this format:
26
+
27
+
`<table>_<column1>*_*<column2>_..._unique`
28
+
29
+
#### Foreign key name handling in the old(pre 1.0) drizzle-kit
30
+
31
+
The old `drizzle-kit` did not handle foreign key names when generated sql migrations. A foreign key name could be defined in the ts schema, but it was not passed through when generating sql
On `introspect` new drizzle-kit parses ddl to find constraint name, if no name found - use default name
51
+
52
+
After running `drizzle-kit up` the first `push` command will result in a diff that recreates the table (no name from db, but there is name in ts schema). To avoid this foreign key names should be removed - in that case no diff will be generated.
53
+
54
+
`drizzle-kit generate` command will behave as expected, no changes needed.
55
+
56
+
#### Bug in the old drizzle-kit related to foreign keys
57
+
58
+
If you add a column to an existing table that has a foreign key and specify `onDelete` or `onUpdate`, column will be added with the foreign key, but without those parameters
There is no way to fix this in the old snapshot. It leads to persistent diffs during `push` with old Drizzle-Kit.
78
+
79
+
New `drizzle-kit` will recreate table after push command with the correct SQL. When using `generate` command, no diffs will appear, but the actual database state may differ
`· You are trying to add reference from "${table}" ("${columns.join('", ')}") to "${tableTo}" ("${
41
+
columnsTo.join(
42
+
'", ',
43
+
)
44
+
}"). The referenced columns are not guaranteed to be unique together. A foreign key must point to a PRIMARY KEY or a set of columns with a UNIQUE constraint. You should add a ${composite}unique constraint to the referenced columns`,
0 commit comments