mirror of
https://github.com/different-ai/openwork
synced 2026-04-25 17:15:34 +02:00
66 lines
2.2 KiB
SQL
66 lines
2.2 KiB
SQL
DROP TABLE IF EXISTS `account`;
|
|
--> statement-breakpoint
|
|
DROP TABLE IF EXISTS `session`;
|
|
--> statement-breakpoint
|
|
DROP TABLE IF EXISTS `verification`;
|
|
--> statement-breakpoint
|
|
DROP TABLE IF EXISTS `user`;
|
|
--> statement-breakpoint
|
|
CREATE TABLE `user` (
|
|
`id` varchar(36) NOT NULL,
|
|
`name` varchar(255) NOT NULL,
|
|
`email` varchar(255) NOT NULL,
|
|
`email_verified` boolean NOT NULL DEFAULT false,
|
|
`image` text,
|
|
`created_at` timestamp(3) NOT NULL DEFAULT (now()),
|
|
`updated_at` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
|
|
CONSTRAINT `user_id` PRIMARY KEY(`id`),
|
|
CONSTRAINT `user_email` UNIQUE(`email`)
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `session` (
|
|
`id` varchar(36) NOT NULL,
|
|
`expires_at` timestamp(3) NOT NULL,
|
|
`token` varchar(255) NOT NULL,
|
|
`created_at` timestamp(3) NOT NULL DEFAULT (now()),
|
|
`updated_at` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
|
|
`ip_address` text,
|
|
`user_agent` text,
|
|
`user_id` varchar(36) NOT NULL,
|
|
CONSTRAINT `session_id` PRIMARY KEY(`id`),
|
|
CONSTRAINT `session_token` UNIQUE(`token`)
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `session_user_id` ON `session` (`user_id`);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `account` (
|
|
`id` varchar(36) NOT NULL,
|
|
`account_id` text NOT NULL,
|
|
`provider_id` text NOT NULL,
|
|
`user_id` varchar(36) NOT NULL,
|
|
`access_token` text,
|
|
`refresh_token` text,
|
|
`id_token` text,
|
|
`access_token_expires_at` timestamp(3),
|
|
`refresh_token_expires_at` timestamp(3),
|
|
`scope` text,
|
|
`password` text,
|
|
`created_at` timestamp(3) NOT NULL DEFAULT (now()),
|
|
`updated_at` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
|
|
CONSTRAINT `account_id` PRIMARY KEY(`id`)
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `account_user_id` ON `account` (`user_id`);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `verification` (
|
|
`id` varchar(36) NOT NULL,
|
|
`identifier` varchar(255) NOT NULL,
|
|
`value` text NOT NULL,
|
|
`expires_at` timestamp(3) NOT NULL,
|
|
`created_at` timestamp(3) NOT NULL DEFAULT (now()),
|
|
`updated_at` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
|
|
CONSTRAINT `verification_id` PRIMARY KEY(`id`)
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `verification_identifier` ON `verification` (`identifier`);
|