-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50f3f15
commit 3511996
Showing
8 changed files
with
251 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
ALTER TABLE `namespace` RENAME COLUMN `topicid` TO `topicId`;--> statement-breakpoint | ||
ALTER TABLE `namespace` DROP FOREIGN KEY `namespace_topicid_topic_id_fk`; | ||
--> statement-breakpoint | ||
ALTER TABLE `flashcard` MODIFY COLUMN `id` int AUTO_INCREMENT NOT NULL;--> statement-breakpoint | ||
ALTER TABLE `flashcard` MODIFY COLUMN `question` text NOT NULL;--> statement-breakpoint | ||
ALTER TABLE `flashcard` MODIFY COLUMN `fillerAnswer` text NOT NULL;--> statement-breakpoint | ||
ALTER TABLE `namespace` MODIFY COLUMN `id` int AUTO_INCREMENT NOT NULL;--> statement-breakpoint | ||
ALTER TABLE `namespace` MODIFY COLUMN `label` varchar(64) NOT NULL;--> statement-breakpoint | ||
ALTER TABLE `topic` MODIFY COLUMN `id` int AUTO_INCREMENT NOT NULL;--> statement-breakpoint | ||
ALTER TABLE `topic` MODIFY COLUMN `label` varchar(64) NOT NULL;--> statement-breakpoint | ||
ALTER TABLE `user` MODIFY COLUMN `id` int AUTO_INCREMENT NOT NULL;--> statement-breakpoint | ||
ALTER TABLE `user` MODIFY COLUMN `username` varchar(64) NOT NULL;--> statement-breakpoint | ||
ALTER TABLE `user` MODIFY COLUMN `email` varchar(320) NOT NULL;--> statement-breakpoint | ||
ALTER TABLE `user` MODIFY COLUMN `passwordHash` varchar(255) NOT NULL;--> statement-breakpoint | ||
ALTER TABLE `namespace` ADD CONSTRAINT `namespace_topicId_topic_id_fk` FOREIGN KEY (`topicId`) REFERENCES `topic`(`id`) ON DELETE no action ON UPDATE no action; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
{ | ||
"version": "5", | ||
"dialect": "mysql", | ||
"id": "f39ecb2f-e883-43ca-b43a-987a9f0e37bc", | ||
"prevId": "f7a34dae-8504-4c15-8748-b3c1fe98ddd0", | ||
"tables": { | ||
"flashcard": { | ||
"name": "flashcard", | ||
"columns": { | ||
"id": { | ||
"name": "id", | ||
"type": "int", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": true | ||
}, | ||
"question": { | ||
"name": "question", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
}, | ||
"correctAnswer": { | ||
"name": "correctAnswer", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"autoincrement": false | ||
}, | ||
"fillerAnswer": { | ||
"name": "fillerAnswer", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": {}, | ||
"compositePrimaryKeys": { | ||
"flashcard_id": { | ||
"name": "flashcard_id", | ||
"columns": [ | ||
"id" | ||
] | ||
} | ||
}, | ||
"uniqueConstraints": {} | ||
}, | ||
"namespace": { | ||
"name": "namespace", | ||
"columns": { | ||
"id": { | ||
"name": "id", | ||
"type": "int", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": true | ||
}, | ||
"public": { | ||
"name": "public", | ||
"type": "boolean", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
}, | ||
"label": { | ||
"name": "label", | ||
"type": "varchar(64)", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
}, | ||
"topicId": { | ||
"name": "topicId", | ||
"type": "int", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": { | ||
"namespace_topicId_topic_id_fk": { | ||
"name": "namespace_topicId_topic_id_fk", | ||
"tableFrom": "namespace", | ||
"tableTo": "topic", | ||
"columnsFrom": [ | ||
"topicId" | ||
], | ||
"columnsTo": [ | ||
"id" | ||
], | ||
"onDelete": "no action", | ||
"onUpdate": "no action" | ||
} | ||
}, | ||
"compositePrimaryKeys": { | ||
"namespace_id": { | ||
"name": "namespace_id", | ||
"columns": [ | ||
"id" | ||
] | ||
} | ||
}, | ||
"uniqueConstraints": {} | ||
}, | ||
"topic": { | ||
"name": "topic", | ||
"columns": { | ||
"id": { | ||
"name": "id", | ||
"type": "int", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": true | ||
}, | ||
"label": { | ||
"name": "label", | ||
"type": "varchar(64)", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": {}, | ||
"compositePrimaryKeys": { | ||
"topic_id": { | ||
"name": "topic_id", | ||
"columns": [ | ||
"id" | ||
] | ||
} | ||
}, | ||
"uniqueConstraints": {} | ||
}, | ||
"user": { | ||
"name": "user", | ||
"columns": { | ||
"id": { | ||
"name": "id", | ||
"type": "int", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": true | ||
}, | ||
"username": { | ||
"name": "username", | ||
"type": "varchar(64)", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
}, | ||
"email": { | ||
"name": "email", | ||
"type": "varchar(320)", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
}, | ||
"passwordHash": { | ||
"name": "passwordHash", | ||
"type": "varchar(255)", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": {}, | ||
"compositePrimaryKeys": { | ||
"user_id": { | ||
"name": "user_id", | ||
"columns": [ | ||
"id" | ||
] | ||
} | ||
}, | ||
"uniqueConstraints": {} | ||
} | ||
}, | ||
"_meta": { | ||
"schemas": {}, | ||
"tables": {}, | ||
"columns": { | ||
"\"namespace\".\"topicid\"": "\"namespace\".\"topicId\"" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { int, mysqlTable, text } from 'drizzle-orm/mysql-core'; | ||
|
||
export const flashcard = mysqlTable('flashcard', { | ||
id: int('id').primaryKey(), | ||
question: text('question'), | ||
id: int('id').primaryKey().autoincrement(), | ||
question: text('question').notNull(), | ||
correctAnswer: text('correctAnswer'), | ||
// TODO: convert to typed json | ||
fillerAnswer: text('fillerAnswer'), | ||
fillerAnswer: text('fillerAnswer').notNull(), | ||
}); |
Oops, something went wrong.