mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-10-02 20:57:03 +00:00
Production reads DATABASE_URL (postgres://) through @profullstack/libsql-pg, which keeps the @libsql/client surface; no query changed. A missing, non-Postgres or leftover libsql:// URL fails at boot in production. Dev and tests keep libSQL (file:/:memory:) as a devDependency. Postgres migrations in src/migrations-pg/ (converted with libsql-pg convert-schema, same file names so the copied _migrations ledger matches); migrate.mjs picks the dialect. Tests run against Postgres with PWA_TEST_DATABASE_URL. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
16 lines
663 B
SQL
16 lines
663 B
SQL
-- Converted from SQLite by @profullstack/libsql-pg. Review every TODO before applying.
|
|
-- Types: INTEGER -> bigint, REAL -> double precision, BLOB -> bytea, BOOLEAN -> boolean,
|
|
-- DATETIME/TIMESTAMP -> timestamptz, TEXT -> text; INTEGER PRIMARY KEY -> identity.
|
|
|
|
create table if not exists cli_device_codes (
|
|
device_code_hash text PRIMARY KEY,
|
|
user_code text NOT NULL UNIQUE,
|
|
user_id text REFERENCES users(id) ON DELETE CASCADE,
|
|
name text,
|
|
status text NOT NULL DEFAULT 'pending',
|
|
created_at bigint NOT NULL,
|
|
expires_at bigint NOT NULL,
|
|
last_polled_at bigint
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_cli_device_user_code ON cli_device_codes(user_code);
|