This commit introduces several new scripts for managing database operations, including user creation, permission grants, and data migrations. It also adds new documentation files to guide users through the setup and configuration processes. Additionally, the project structure is updated to enhance organization and maintainability, ensuring a smoother development experience for contributors. These changes support the ongoing transition to a web-based architecture and improve overall project functionality.
31 lines
985 B
SQL
31 lines
985 B
SQL
-- Migration: Add email verification columns to users table
|
|
-- Run this migration on the punimtag_auth database
|
|
|
|
-- Add email_verified column (defaults to false for new users, true for existing users)
|
|
ALTER TABLE users
|
|
ADD COLUMN IF NOT EXISTS email_verified BOOLEAN NOT NULL DEFAULT true;
|
|
|
|
-- Add email_confirmation_token column
|
|
ALTER TABLE users
|
|
ADD COLUMN IF NOT EXISTS email_confirmation_token VARCHAR(255) UNIQUE;
|
|
|
|
-- Add email_confirmation_token_expiry column
|
|
ALTER TABLE users
|
|
ADD COLUMN IF NOT EXISTS email_confirmation_token_expiry TIMESTAMP;
|
|
|
|
-- Create index on email_confirmation_token for faster lookups
|
|
CREATE INDEX IF NOT EXISTS idx_users_email_confirmation_token ON users(email_confirmation_token);
|
|
|
|
-- Update existing users to have verified emails (for backward compatibility)
|
|
-- Only update users that don't have the token set (meaning they were created before this migration)
|
|
UPDATE users
|
|
SET email_verified = true
|
|
WHERE email_confirmation_token IS NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|