Skip to content

Commit

Permalink
🚀 checkoutコマンドを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
kawamataryo committed Feb 1, 2025
1 parent 0984f47 commit fa512bf
Show file tree
Hide file tree
Showing 18 changed files with 655 additions and 76 deletions.
10 changes: 10 additions & 0 deletions drizzle/0004_fantastic_electro.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CREATE TABLE `checkouts` (
`id` integer PRIMARY KEY NOT NULL,
`date` text DEFAULT CURRENT_DATE,
`user_id` integer NOT NULL,
`content` text NOT NULL,
`created_at` text DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE INDEX `checkouts_userId_idx` ON `checkouts` (`user_id`);
284 changes: 284 additions & 0 deletions drizzle/meta/0004_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
{
"version": "5",
"dialect": "sqlite",
"id": "611abc5e-97a2-4509-8688-404a2523ef23",
"prevId": "a24f9881-d3b1-478b-83f7-10bcdff88b98",
"tables": {
"checkins": {
"name": "checkins",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"date": {
"name": "date",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "CURRENT_DATE"
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"profile": {
"name": "profile",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"todo": {
"name": "todo",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {
"userId_idx": {
"name": "userId_idx",
"columns": ["user_id"],
"isUnique": false
}
},
"foreignKeys": {
"checkins_user_id_users_id_fk": {
"name": "checkins_user_id_users_id_fk",
"tableFrom": "checkins",
"tableTo": "users",
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"checkouts": {
"name": "checkouts",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"date": {
"name": "date",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "CURRENT_DATE"
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {
"checkouts_userId_idx": {
"name": "checkouts_userId_idx",
"columns": ["user_id"],
"isUnique": false
}
},
"foreignKeys": {
"checkouts_user_id_users_id_fk": {
"name": "checkouts_user_id_users_id_fk",
"tableFrom": "checkouts",
"tableTo": "users",
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"events": {
"name": "events",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"date": {
"name": "date",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"events_to_checkins": {
"name": "events_to_checkins",
"columns": {
"event_id": {
"name": "event_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"checkin_id": {
"name": "checkin_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"events_to_checkins_event_id_events_id_fk": {
"name": "events_to_checkins_event_id_events_id_fk",
"tableFrom": "events_to_checkins",
"tableTo": "events",
"columnsFrom": ["event_id"],
"columnsTo": ["id"],
"onDelete": "no action",
"onUpdate": "no action"
},
"events_to_checkins_checkin_id_checkins_id_fk": {
"name": "events_to_checkins_checkin_id_checkins_id_fk",
"tableFrom": "events_to_checkins",
"tableTo": "checkins",
"columnsFrom": ["checkin_id"],
"columnsTo": ["id"],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"events_to_checkins_event_id_checkin_id_pk": {
"columns": ["checkin_id", "event_id"],
"name": "events_to_checkins_event_id_checkin_id_pk"
}
},
"uniqueConstraints": {}
},
"users": {
"name": "users",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"discord_user_id": {
"name": "discord_user_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "CURRENT_TIMESTAMP"
}
},
"indexes": {
"users_discord_user_id_unique": {
"name": "users_discord_user_id_unique",
"columns": ["discord_user_id"],
"isUnique": true
},
"name_idx": {
"name": "name_idx",
"columns": ["name"],
"isUnique": false
},
"discordUserId_idx": {
"name": "discordUserId_idx",
"columns": ["discord_user_id"],
"isUnique": false
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
}
}
7 changes: 7 additions & 0 deletions drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
"when": 1709266132201,
"tag": "0003_free_dakota_north",
"breakpoints": true
},
{
"idx": 4,
"version": "5",
"when": 1738394221714,
"tag": "0004_fantastic_electro",
"breakpoints": true
}
]
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"deploy": "wrangler deploy --minify src/index.ts",
"check": "bunx @biomejs/biome check --apply ./src",
"generate": "drizzle-kit generate:sqlite --schema=src/schema.ts",
"migrate:local": "wrangler d1 migrations apply prod-mokumoku-bot",
"migrate:prod": "wrangler d1 migrations apply prod-mokumoku-bot --remote",
"up": "drizzle-kit up:sqlite --schema=src/schema.ts",
"test": "vitest"
},
Expand Down
Loading

0 comments on commit fa512bf

Please sign in to comment.