This commit is contained in:
2026-09-15 09:15:53 -05:00
parent 97c930196a
commit ab9573b875
21 changed files with 1664 additions and 0 deletions
@@ -0,0 +1,14 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE public.anglers (
angler_id UUID NOT NULL DEFAULT gen_random_uuid(),
angler_username TEXT NOT NULL UNIQUE,
angler_password TEXT NOT NULL,
angler_email TEXT
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE public.anglers;
-- +goose StatementEnd
@@ -0,0 +1,37 @@
-- +goose Up
-- +goose StatementBegin
ALTER TABLE public.anglers ADD PRIMARY KEY (angler_id);
CREATE TABLE public.fish (
fish_id UUID NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
fish_name TEXT NOT NULL,
fish_desc TEXT NOT NULL,
fish_size_oz_max NUMERIC NOT NULL,
fish_size_oz_min NUMERIC NOT NULL
);
CREATE TABLE public.catches (
catch_id UUID NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
catch_caught_at TIMESTAMPTZ NOT NULL,
catch_size_oz NUMERIC NOT NULL,
angler_id UUID NOT NULL REFERENCES public.anglers(angler_id),
fish_id UUID NOT NULL REFERENCES public.fish(fish_id)
);
CREATE TABLE public.casts (
cast_id UUID NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
cast_started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
cast_ended_at TIMESTAMPTZ,
angler_id UUID NOT NULL REFERENCES public.anglers(angler_id),
catch_id UUID REFERENCES public.catches(catch_id)
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
ALTER TABLE public.anglers DROP CONSTRAINT anglers_pkey
DROP TABLE public.fish;
DROP TABLE public.catches;
DROP TABLE public.casts;
-- +goose StatementEnd
@@ -0,0 +1,15 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE public.ssh_keys (
key_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
angler_id UUID NOT NULL REFERENCES public.anglers(angler_id),
key_type TEXT NOT NULL,
key_data BYTEA NOT NULL UNIQUE,
key_fingerprint TEXT
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE public.ssh_keys;
-- +goose StatementEnd
+6
View File
@@ -0,0 +1,6 @@
package migrations
import "embed"
//go:embed *.sql
var Files embed.FS