Skip to content

Commit

Permalink
feat: rename from email to username
Browse files Browse the repository at this point in the history
  • Loading branch information
ixartz committed Aug 19, 2023
1 parent 10f4943 commit 52ab0e4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE TABLE `guestbook` (
`id` integer PRIMARY KEY NOT NULL,
`email` text,
`body` text,
`username` text NOT NULL,
`body` text NOT NULL,
`created_at` integer DEFAULT (strftime('%s', 'now')),
`updated_at` integer DEFAULT (strftime('%s', 'now'))
);
10 changes: 5 additions & 5 deletions migrations/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "5",
"dialect": "sqlite",
"id": "c55aece1-11e9-4c82-9457-bce886c9e3f9",
"id": "33ba2aeb-9902-4f71-9e40-f18012cd5d31",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"guestbook": {
Expand All @@ -14,18 +14,18 @@
"notNull": true,
"autoincrement": false
},
"email": {
"name": "email",
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": false,
"notNull": true,
"autoincrement": false
},
"body": {
"name": "body",
"type": "text",
"primaryKey": false,
"notNull": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
Expand Down
4 changes: 2 additions & 2 deletions migrations/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
{
"idx": 0,
"version": "5",
"when": 1692480169696,
"tag": "0000_new_prowler",
"when": 1692483682335,
"tag": "0000_sharp_marten_broadcloak",
"breakpoints": true
}
]
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/guestbook/add/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const POST = async () => {
.insert(guestbookTable)
.values({
body: 'hello',
email: 'random@gmail.com',
username: 'random',
})
.run();

Expand Down
4 changes: 2 additions & 2 deletions src/models/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';

export const guestbookTable = sqliteTable('guestbook', {
id: integer('id').primaryKey(),
email: text('email'),
body: text('body'),
username: text('username').notNull(),
body: text('body').notNull(),
createdAt: integer('created_at', { mode: 'timestamp' }).default(
sql`(strftime('%s', 'now'))`,
),
Expand Down

0 comments on commit 52ab0e4

Please sign in to comment.