0
Fork 0
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:
Ben Holmes 2024-03-12 07:30:45 -04:00 committed by GitHub
parent 629c9d7c4d
commit 41ca94e513
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
"@astrojs/db": patch
---
Remove risk of data loss when pushing an out-of-date table schema.

View file

@ -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));
}

View file

@ -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)`,
]);
});