mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -05:00
chore: remove drop table check for added table (#10396)
* chore: remove drop table check for added table * chore: remove drop table from test * chore: changeset
This commit is contained in:
parent
629c9d7c4d
commit
41ca94e513
3 changed files with 5 additions and 2 deletions
5
.changeset/lazy-tools-reply.md
Normal file
5
.changeset/lazy-tools-reply.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@astrojs/db": patch
|
||||
---
|
||||
|
||||
Remove risk of data loss when pushing an out-of-date table schema.
|
|
@ -61,7 +61,6 @@ export async function getMigrationQueries({
|
|||
}
|
||||
|
||||
for (const [collectionName, collection] of Object.entries(addedCollections)) {
|
||||
queries.push(getDropTableIfExistsQuery(collectionName));
|
||||
queries.push(getCreateTableQuery(collectionName, collection));
|
||||
queries.push(...getCreateIndexQueries(collectionName, collection));
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ describe('column queries', () => {
|
|||
const newCollections = { [TABLE_NAME]: userInitial };
|
||||
const { queries } = await configChangeQueries(oldCollections, newCollections);
|
||||
expect(queries).to.deep.equal([
|
||||
`DROP TABLE IF EXISTS "${TABLE_NAME}"`,
|
||||
`CREATE TABLE "${TABLE_NAME}" (_id INTEGER PRIMARY KEY, "name" text NOT NULL, "age" integer NOT NULL, "email" text NOT NULL UNIQUE, "mi" text)`,
|
||||
]);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue