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.
20 lines
655 B
SQL
20 lines
655 B
SQL
-- Migration: Make name column required (NOT NULL) in users table
|
|
-- Run this as a PostgreSQL superuser or with appropriate permissions
|
|
-- Prerequisites: All existing users must have a non-null name value
|
|
|
|
-- First, ensure all existing users have a name (safety check)
|
|
-- This should not update any rows if all users already have names
|
|
UPDATE users
|
|
SET name = email
|
|
WHERE name IS NULL;
|
|
|
|
-- Alter the column to be NOT NULL
|
|
ALTER TABLE users
|
|
ALTER COLUMN name SET NOT NULL;
|
|
|
|
-- Verify the column constraint
|
|
SELECT column_name, data_type, is_nullable, column_default
|
|
FROM information_schema.columns
|
|
WHERE table_name = 'users' AND column_name = 'name';
|
|
|