{"Addresses": {"columns": [[0, "Address_ID", "INTEGER", 1, null, 1], [1, "address_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Address_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Address_ID"]]], "check_constraints": []}, "Locations": {"columns": [[0, "Location_ID", "INTEGER", 1, null, 1], [1, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Location_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Products": {"columns": [[0, "Product_ID", "INTEGER", 1, null, 1], [1, "Product_Type_Code", "CHAR(15)", 0, null, 0], [2, "Product_Name", "VARCHAR(255)", 0, null, 0], [3, "Product_Price", "DECIMAL(20,4)", 0, null, 0]], "primary_keys": ["Product_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Product_ID"]]], "check_constraints": []}, "Parties": {"columns": [[0, "Party_ID", "INTEGER", 1, null, 1], [1, "Party_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Party_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Assets": {"columns": [[0, "Asset_ID", "INTEGER", 1, null, 1], [1, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Asset_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Channels": {"columns": [[0, "Channel_ID", "INTEGER", 1, null, 1], [1, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Channel_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Finances": {"columns": [[0, "Finance_ID", "INTEGER", 1, null, 1], [1, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Finance_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Events": {"columns": [[0, "Event_ID", "INTEGER", 1, null, 1], [1, "Address_ID", "INTEGER", 0, null, 0], [2, "Channel_ID", "INTEGER", 1, null, 0], [3, "Event_Type_Code", "CHAR(15)", 0, null, 0], [4, "Finance_ID", "INTEGER", 1, null, 0], [5, "Location_ID", "INTEGER", 1, null, 0]], "primary_keys": ["Event_ID"], "foreign_keys": [[0, 0, "Finances", "Finance_ID", "Finance_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Addresses", "Address_ID", "Address_ID", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Locations", "Location_ID", "Location_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Event_ID"]]], "check_constraints": []}, "Products_in_Events": {"columns": [[0, "Product_in_Event_ID", "INTEGER", 1, null, 1], [1, "Event_ID", "INTEGER", 1, null, 0], [2, "Product_ID", "INTEGER", 1, null, 0]], "primary_keys": ["Product_in_Event_ID"], "foreign_keys": [[0, 0, "Products", "Product_ID", "Product_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Events", "Event_ID", "Event_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Parties_in_Events": {"columns": [[0, "Party_ID", "INTEGER", 1, null, 1], [1, "Event_ID", "INTEGER", 1, null, 2], [2, "Role_Code", "CHAR(15)", 0, null, 0]], "primary_keys": ["Party_ID", "Event_ID"], "foreign_keys": [[0, 0, "Events", "Event_ID", "Event_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Parties", "Party_ID", "Party_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Party_ID"], [1, 1, "Event_ID"]]], "check_constraints": []}, "Agreements": {"columns": [[0, "Document_ID", "INTEGER", 1, null, 1], [1, "Event_ID", "INTEGER", 1, null, 0]], "primary_keys": ["Document_ID"], "foreign_keys": [[0, 0, "Events", "Event_ID", "Event_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Assets_in_Events": {"columns": [[0, "Asset_ID", "INTEGER", 1, null, 1], [1, "Event_ID", "INTEGER", 1, null, 2]], "primary_keys": ["Asset_ID", "Event_ID"], "foreign_keys": [[0, 0, "Events", "Event_ID", "Event_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Events", "Event_ID", "Event_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Asset_ID"], [1, 1, "Event_ID"]]], "check_constraints": []}}
CREATE TABLE Addresses (
    Address_ID INTEGER NOT NULL  PRIMARY KEY,
    address_details VARCHAR(255),
    UNIQUE (Address_ID)
);

CREATE TABLE Locations (
    Location_ID INTEGER NOT NULL  PRIMARY KEY,
    Other_Details VARCHAR(255)
);

CREATE TABLE Products (
    Product_ID INTEGER NOT NULL  PRIMARY KEY,
    Product_Type_Code CHAR(15),
    Product_Name VARCHAR(255),
    Product_Price DECIMAL(20,4),
    UNIQUE (Product_ID)
);

CREATE TABLE Parties (
    Party_ID INTEGER NOT NULL  PRIMARY KEY,
    Party_Details VARCHAR(255)
);

CREATE TABLE Assets (
    Asset_ID INTEGER NOT NULL  PRIMARY KEY,
    Other_Details VARCHAR(255)
);

CREATE TABLE Channels (
    Channel_ID INTEGER NOT NULL  PRIMARY KEY,
    Other_Details VARCHAR(255)
);

CREATE TABLE Finances (
    Finance_ID INTEGER NOT NULL  PRIMARY KEY,
    Other_Details VARCHAR(255)
);

CREATE TABLE Events (
    Event_ID INTEGER NOT NULL  PRIMARY KEY,
    Address_ID INTEGER,
    Channel_ID INTEGER NOT NULL,
    Event_Type_Code CHAR(15),
    Finance_ID INTEGER NOT NULL,
    Location_ID INTEGER NOT NULL,
    UNIQUE (Event_ID),
    FOREIGN KEY (Finance_ID) REFERENCES Finances(Finance_ID),
    FOREIGN KEY (Address_ID) REFERENCES Addresses(Address_ID),
    FOREIGN KEY (Location_ID) REFERENCES Locations(Location_ID)
);

CREATE TABLE Products_in_Events (
    Product_in_Event_ID INTEGER NOT NULL  PRIMARY KEY,
    Event_ID INTEGER NOT NULL,
    Product_ID INTEGER NOT NULL,
    FOREIGN KEY (Product_ID) REFERENCES Products(Product_ID),
    FOREIGN KEY (Event_ID) REFERENCES Events(Event_ID)
);

CREATE TABLE Parties_in_Events (
    Party_ID INTEGER NOT NULL  PRIMARY KEY,
    Event_ID INTEGER NOT NULL  PRIMARY KEY,
    Role_Code CHAR(15),
    PRIMARY KEY (Party_ID, Event_ID),
    UNIQUE (Party_ID, Event_ID),
    FOREIGN KEY (Event_ID) REFERENCES Events(Event_ID),
    FOREIGN KEY (Party_ID) REFERENCES Parties(Party_ID)
);

CREATE TABLE Agreements (
    Document_ID INTEGER NOT NULL  PRIMARY KEY,
    Event_ID INTEGER NOT NULL,
    FOREIGN KEY (Event_ID) REFERENCES Events(Event_ID)
);

CREATE TABLE Assets_in_Events (
    Asset_ID INTEGER NOT NULL  PRIMARY KEY,
    Event_ID INTEGER NOT NULL  PRIMARY KEY,
    PRIMARY KEY (Asset_ID, Event_ID),
    UNIQUE (Asset_ID, Event_ID),
    FOREIGN KEY (Event_ID) REFERENCES Events(Event_ID),
    FOREIGN KEY (Event_ID) REFERENCES Events(Event_ID)
);