From c31743eed1915f18c465b3d918302a21729d6442 Mon Sep 17 00:00:00 2001 From: phoenix Date: Sat, 2 Aug 2025 15:05:49 -0400 Subject: [PATCH] Adding test migrations --- test_migrations/20250802185608_init.down.sql | 4 +++ test_migrations/20250802185608_init.up.sql | 28 +++++++++++++++++++ .../20250802190131_passphrase_data.down.sql | 2 ++ .../20250802190131_passphrase_data.up.sql | 2 ++ 4 files changed, 36 insertions(+) create mode 100644 test_migrations/20250802185608_init.down.sql create mode 100644 test_migrations/20250802185608_init.up.sql create mode 100644 test_migrations/20250802190131_passphrase_data.down.sql create mode 100644 test_migrations/20250802190131_passphrase_data.up.sql diff --git a/test_migrations/20250802185608_init.down.sql b/test_migrations/20250802185608_init.down.sql new file mode 100644 index 0000000..1bcddd4 --- /dev/null +++ b/test_migrations/20250802185608_init.down.sql @@ -0,0 +1,4 @@ +-- Add down migration script here +DROP TABLE IF EXISTS "user"; +DROP TABLE IF EXISTS "salt"; +DROP TABLE IF EXISTS "passphrase"; diff --git a/test_migrations/20250802185608_init.up.sql b/test_migrations/20250802185608_init.up.sql new file mode 100644 index 0000000..c1d9c85 --- /dev/null +++ b/test_migrations/20250802185608_init.up.sql @@ -0,0 +1,28 @@ +-- Add up migration script here +CREATE EXTENSION IF NOT EXISTS pgcrypto; + +CREATE TABLE IF NOT EXISTS "user" ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + username TEXT NOT NULL, + password TEXT NOT NULL, + email TEXT NOT NULL, + phone TEXT NOT NULL, + firstname TEXT NOT NULL, + lastname TEXT NOT NULL, + email_verified BOOL NOT NULL, + date_created TIMESTAMPTZ NOT NULL DEFAULT NOW(), + status TEXT NOT NULL, + last_login TIMESTAMPTZ NULL DEFAULT NOW(), + salt_id UUID NOT NULL +); + +CREATE TABLE IF NOT EXISTS "salt" ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + salt TEXT NOT NULL +); + +CREATE TABLE IF NOT EXISTS "passphrase" ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + passphrase TEXT NOT NULL, + date_created TIMESTAMPTZ NOT NULL DEFAULT NOW() +); diff --git a/test_migrations/20250802190131_passphrase_data.down.sql b/test_migrations/20250802190131_passphrase_data.down.sql new file mode 100644 index 0000000..1fe56a3 --- /dev/null +++ b/test_migrations/20250802190131_passphrase_data.down.sql @@ -0,0 +1,2 @@ +-- Add down migration script here +DELETE FROM "passphrase"; diff --git a/test_migrations/20250802190131_passphrase_data.up.sql b/test_migrations/20250802190131_passphrase_data.up.sql new file mode 100644 index 0000000..a1080a0 --- /dev/null +++ b/test_migrations/20250802190131_passphrase_data.up.sql @@ -0,0 +1,2 @@ +-- Add up migration script here +INSERT INTO "passphrase" (passphrase) VALUES('Hg3TWfAT8pEiW6fZGhQKXICkZ246EzrE8Bx26O9iEKmQkbpzlFJTOW8UwSf09oak');