saasitone/db/migrations/001_init.up.sql

24 lines
649 B
MySQL
Raw Permalink Normal View History

2024-07-11 21:09:15 -07:00
CREATE TABLE password_tokens (
id integer NOT NULL PRIMARY KEY AUTOINCREMENT,
hash text NOT NULL,
created_at text NOT NULL DEFAULT CURRENT_TIMESTAMP,
password_token_user integer NOT NULL,
CONSTRAINT `password_tokens_users_user`
FOREIGN KEY (`password_token_user`)
REFERENCES `users` (`id`)
ON DELETE NO ACTION
) STRICT;
CREATE TABLE users (
id integer NOT NULL PRIMARY KEY AUTOINCREMENT,
name text NOT NULL,
email text NOT NULL,
password text NOT NULL,
verified integer NOT NULL DEFAULT 0,
created_at text NOT NULL DEFAULT CURRENT_TIMESTAMP
) STRICT;
CREATE UNIQUE INDEX `users_email_key` ON `users` (`email`);