initial
This commit is contained in:
45
drizzle/0000_aspiring_paibok.sql
Normal file
45
drizzle/0000_aspiring_paibok.sql
Normal file
@@ -0,0 +1,45 @@
|
||||
CREATE TABLE `groups` (
|
||||
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
`name` text
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `opinions` (
|
||||
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
`name` text,
|
||||
`type` text
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `provinces` (
|
||||
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
`name` text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `users` (
|
||||
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
`name` text,
|
||||
`phone` text NOT NULL,
|
||||
`email` text,
|
||||
`job` text,
|
||||
`education` text,
|
||||
`vision` text,
|
||||
`reason` text,
|
||||
`group_id` integer,
|
||||
FOREIGN KEY (`group_id`) REFERENCES `groups`(`id`) ON UPDATE no action ON DELETE no action
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `user_opinions` (
|
||||
`user_id` integer,
|
||||
`opinion_id` integer,
|
||||
`choice` text DEFAULT 'ignore',
|
||||
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action,
|
||||
FOREIGN KEY (`opinion_id`) REFERENCES `opinions`(`id`) ON UPDATE no action ON DELETE no action
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `zones` (
|
||||
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
`name` text NOT NULL,
|
||||
`province_id` integer NOT NULL,
|
||||
FOREIGN KEY (`province_id`) REFERENCES `provinces`(`id`) ON UPDATE no action ON DELETE no action
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `users_phone_unique` ON `users` (`phone`);
|
||||
Reference in New Issue
Block a user