organization

Column Type PK Required Default
organization_id ULID Yes Yes
party_id VARCHAR No Yes
name TEXT No Yes
alias TEXT No No
description TEXT No No
license TEXT No Yes
federal_tax_id_num TEXT No No
registration_date DATE No Yes
elaboration TEXT No No
created_at TIMESTAMPTZ No No CURRENT_TIMESTAMP
created_by TEXT No No 'UNKNOWN'
updated_at TIMESTAMPTZ No No
updated_by TEXT No No
deleted_at TIMESTAMPTZ No No
deleted_by TEXT No No
activity_log TEXT No No

Foreign Keys

Column Name Foreign Key
party_id party_id references party.party_id

Indexes

Column Name Index Name
organization_id sqlite_autoindex_organization_1

SQL DDL

CREATE TABLE "organization" (
    "organization_id" ULID PRIMARY KEY NOT NULL,
    "party_id" VARCHAR NOT NULL,
    "name" TEXT NOT NULL,
    "alias" TEXT,
    "description" TEXT,
    "license" TEXT NOT NULL,
    "federal_tax_id_num" TEXT,
    "registration_date" DATE NOT NULL,
    "elaboration" TEXT CHECK(json_valid(elaboration) OR elaboration IS NULL),
    "created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
    "created_by" TEXT DEFAULT 'UNKNOWN',
    "updated_at" TIMESTAMPTZ,
    "updated_by" TEXT,
    "deleted_at" TIMESTAMPTZ,
    "deleted_by" TEXT,
    "activity_log" TEXT,
    FOREIGN KEY("party_id") REFERENCES "party"("party_id")
)