35063-vm/db/migrations/001_create_users_and_payments_tables.sql
Flatlogic Bot f03532c201 12
2025-10-19 20:05:43 +00:00

18 lines
566 B
SQL

CREATE TABLE IF NOT EXISTS `users` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`email` VARCHAR(255) UNIQUE NOT NULL,
`is_premium` BOOLEAN NOT NULL DEFAULT FALSE,
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS `payments` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`user_id` INT,
`stripe_payment_intent_id` VARCHAR(255) UNIQUE NOT NULL,
`amount` INT NOT NULL,
`currency` VARCHAR(10) NOT NULL,
`status` VARCHAR(50) NOT NULL,
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id)
);