-- Migration: Fix organization updated_at to be nullable (better-auth doesn't set it on create)
-- SQLite doesn't support ALTER COLUMN, so we recreate the table
-- Drop and recreate organization table with updated_at as nullable
DROP TABLE IF EXISTS organization;
CREATE TABLE organization (
id TEXT PRIMARY KEY NOT NULL,
name TEXT NOT NULL,
slug TEXT NOT NULL UNIQUE,
logo TEXT,
metadata TEXT,
created_at INTEGER NOT NULL,
updated_at INTEGER -- Nullable, better-auth sets it to null on create
);
-- Also need to fix team table if it has the same issue
DROP TABLE IF EXISTS team;
CREATE TABLE team (
id TEXT PRIMARY KEY NOT NULL,
name TEXT NOT NULL,
organization_id TEXT NOT NULL REFERENCES organization(id) ON DELETE CASCADE,
created_at INTEGER NOT NULL,
updated_at INTEGER -- Nullable
);