Skip to content

Commit

Permalink
feat: add drizzle config and database schema
Browse files Browse the repository at this point in the history
  • Loading branch information
ixartz committed Aug 18, 2023
1 parent 0e26234 commit df30388
Show file tree
Hide file tree
Showing 8 changed files with 1,831 additions and 90 deletions.
6 changes: 6 additions & 0 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { Config } from 'drizzle-kit';

export default {
out: './migrations',
schema: './src/models/schema.ts',
} satisfies Config;
7 changes: 7 additions & 0 deletions migrations/0000_curvy_spacker_dave.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CREATE TABLE `guestbook` (
`id` integer PRIMARY KEY NOT NULL,
`email` text NOT NULL,
`body` text NOT NULL,
`created_at` integer DEFAULT (strftime('%s', 'now')),
`updated_at` integer DEFAULT (strftime('%s', 'now'))
);
60 changes: 60 additions & 0 deletions migrations/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"version": "5",
"dialect": "sqlite",
"id": "2c0ef5a2-66f5-48e4-99f6-b3eca322c507",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"guestbook": {
"name": "guestbook",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"body": {
"name": "body",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "(strftime('%s', 'now'))"
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "(strftime('%s', 'now'))"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
}
}
13 changes: 13 additions & 0 deletions migrations/meta/_journal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "5",
"dialect": "sqlite",
"entries": [
{
"idx": 0,
"version": "5",
"when": 1692396438758,
"tag": "0000_curvy_spacker_dave",
"breakpoints": true
}
]
}
Loading

0 comments on commit df30388

Please sign in to comment.