diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a387a36..5c575f9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -16,6 +16,7 @@ jobs: node-version: 20 cache: 'npm' - run: npm ci + - run: npm run db:introspect - run: npm run db:migrate env: TURSO_DATABASE_URL: ${{ secrets.TURSO_DATABASE_URL }} diff --git a/migrations/0000_complete_polaris.sql b/migrations/0000_complete_polaris.sql deleted file mode 100644 index 871f980..0000000 --- a/migrations/0000_complete_polaris.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE `foo` ( - `bar` text DEFAULT 'Hey!' NOT NULL, - `baz` text DEFAULT 'Hello World!' NOT NULL -); diff --git a/migrations/0001_steady_the_twelve.sql b/migrations/0001_steady_the_twelve.sql deleted file mode 100644 index 95c38c2..0000000 --- a/migrations/0001_steady_the_twelve.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE `author` ( - `id` text PRIMARY KEY NOT NULL, - `name` text NOT NULL -); ---> statement-breakpoint -CREATE TABLE `quote` ( - `id` text PRIMARY KEY NOT NULL, - `quote` text NOT NULL, - `author_id` text -); ---> statement-breakpoint -DROP TABLE `foo`;--> statement-breakpoint -CREATE UNIQUE INDEX `author_id_unique` ON `author` (`id`);--> statement-breakpoint -CREATE UNIQUE INDEX `quote_id_unique` ON `quote` (`id`); \ No newline at end of file diff --git a/migrations/0002_daily_mercury.sql b/migrations/0002_daily_mercury.sql deleted file mode 100644 index 98fa71d..0000000 --- a/migrations/0002_daily_mercury.sql +++ /dev/null @@ -1,16 +0,0 @@ -/* - SQLite does not support "Set autoincrement to a column" out of the box, we do not generate automatic migration for that, so it has to be done manually - Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php - https://www.sqlite.org/lang_altertable.html - https://stackoverflow.com/questions/2083543/modify-a-columns-type-in-sqlite3 - - Due to that we don't generate migration automatically and it has to be done manually -*/--> statement-breakpoint -/* - SQLite does not support "Changing existing column type" out of the box, we do not generate automatic migration for that, so it has to be done manually - Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php - https://www.sqlite.org/lang_altertable.html - https://stackoverflow.com/questions/2083543/modify-a-columns-type-in-sqlite3 - - Due to that we don't generate migration automatically and it has to be done manually -*/ \ No newline at end of file diff --git a/migrations/meta/0000_snapshot.json b/migrations/meta/0000_snapshot.json deleted file mode 100644 index c40b220..0000000 --- a/migrations/meta/0000_snapshot.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "version": "5", - "dialect": "sqlite", - "id": "667f1a76-a693-43ea-b0da-0bc290050c9e", - "prevId": "00000000-0000-0000-0000-000000000000", - "tables": { - "foo": { - "name": "foo", - "columns": { - "bar": { - "name": "bar", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Hey!'" - }, - "baz": { - "name": "baz", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Hello World!'" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0001_snapshot.json b/migrations/meta/0001_snapshot.json deleted file mode 100644 index dcbfb4d..0000000 --- a/migrations/meta/0001_snapshot.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "version": "5", - "dialect": "sqlite", - "id": "4361308a-3c5c-46cd-91d7-51faea0ac2d3", - "prevId": "667f1a76-a693-43ea-b0da-0bc290050c9e", - "tables": { - "author": { - "name": "author", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "author_id_unique": { - "name": "author_id_unique", - "columns": [ - "id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "quote": { - "name": "quote", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "quote": { - "name": "quote", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "quote_id_unique": { - "name": "quote_id_unique", - "columns": [ - "id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0002_snapshot.json b/migrations/meta/0002_snapshot.json deleted file mode 100644 index 7f86ffd..0000000 --- a/migrations/meta/0002_snapshot.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "version": "5", - "dialect": "sqlite", - "id": "cb0a8c8e-d9eb-42b9-8f45-d7fc17085bb8", - "prevId": "4361308a-3c5c-46cd-91d7-51faea0ac2d3", - "tables": { - "author": { - "name": "author", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "author_id_unique": { - "name": "author_id_unique", - "columns": [ - "id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "quote": { - "name": "quote", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": true - }, - "quote": { - "name": "quote", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "quote_id_unique": { - "name": "quote_id_unique", - "columns": [ - "id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - } -} \ No newline at end of file diff --git a/migrations/meta/_journal.json b/migrations/meta/_journal.json deleted file mode 100644 index c1ad822..0000000 --- a/migrations/meta/_journal.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "version": "5", - "dialect": "sqlite", - "entries": [ - { - "idx": 0, - "version": "5", - "when": 1714269601775, - "tag": "0000_complete_polaris", - "breakpoints": true - }, - { - "idx": 1, - "version": "5", - "when": 1714273363788, - "tag": "0001_steady_the_twelve", - "breakpoints": true - }, - { - "idx": 2, - "version": "5", - "when": 1714346618320, - "tag": "0002_daily_mercury", - "breakpoints": true - } - ] -} \ No newline at end of file diff --git a/migrations/schema.ts b/migrations/schema.ts deleted file mode 100644 index 2f3aadf..0000000 --- a/migrations/schema.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { sqliteTable, AnySQLiteColumn, uniqueIndex, text, numeric } from "drizzle-orm/sqlite-core" - import { sql } from "drizzle-orm" - -export const author = sqliteTable("author", { - id: text("id").primaryKey().notNull(), - name: text("name").notNull(), -}, -(table) => { - return { - idUnique: uniqueIndex("author_id_unique").on(table.id), - } -}); - -export const quote = sqliteTable("quote", { - id: text("id").primaryKey().notNull(), - quote: text("quote").notNull(), - authorId: text("author_id"), -}, -(table) => { - return { - idUnique: uniqueIndex("quote_id_unique").on(table.id), - } -}); - -export const drizzleMigrations = sqliteTable("__drizzle_migrations", { - id: numeric("id").primaryKey(), - hash: text("hash").notNull(), - createdAt: numeric("created_at"), -}); \ No newline at end of file