changing profile id to schema in the whole project

This commit is contained in:
filipriec
2025-06-21 09:57:14 +02:00
parent 9477f53432
commit 63f1b4da2e
8 changed files with 84 additions and 64 deletions

View File

@@ -1,5 +1,4 @@
-- Main table definitions
CREATE SCHEMA IF NOT EXISTS gen;
CREATE TABLE table_definitions (
id BIGSERIAL PRIMARY KEY,
@@ -8,7 +7,7 @@ CREATE TABLE table_definitions (
columns JSONB NOT NULL,
indexes JSONB NOT NULL,
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
profile_id BIGINT NOT NULL REFERENCES profiles(id) DEFAULT 1
schema_id BIGINT NOT NULL REFERENCES schemas(id)
);
-- Relationship table for multiple links
@@ -20,9 +19,10 @@ CREATE TABLE table_definition_links (
PRIMARY KEY (source_table_id, linked_table_id)
);
-- Create composite unique index for profile+table combination
CREATE UNIQUE INDEX idx_table_definitions_profile_table
ON table_definitions (profile_id, table_name);
-- Create composite unique index for schema+table combination
CREATE UNIQUE INDEX idx_table_definitions_schema_table
ON table_definitions (schema_id, table_name);
CREATE INDEX idx_links_source ON table_definition_links (source_table_id);
CREATE INDEX idx_links_target ON table_definition_links (linked_table_id);