This is the DDL for the default mapping of the Company model.

CREATE TABLE addresses {
    addrid INTEGER PRIMARY KEY,
    street VARCHAR NOT NULL,
    city VARCHAR NOT NULL,
    state CHAR(2) NOT NULL,
    zipcode CHAR(5) NOT NULL,
    country VARCHAR NOT NULL
};

CREATE TABLE companies {
    id INTEGER PRIMARY KEY,
    name VARCHAR NOT NULL,
    foundeddate VARCHAR(32) NOT NULL,
    street VARCHAR NOT NULL,
    city VARCHAR NOT NULL,
    state CHAR(2) NOT NULL,
    zipcode CHAR(5) NOT NULL,
    country VARCHAR NOT NULL
};

CREATE TABLE departments {
    id INTEGER PRIMARY KEY,
    name VARCHAR NOT NULL,
    companyid INTEGER REFERENCES COMPANIES NOT NULL
};

CREATE TABLE employees {
    personid INTEGER PRIMARY KEY,
    firstname VARCHAR(32) NOT NULL,
    lastname VARCHAR(32) NOT NULL,
    middlename VARCHAR(32),
    birthdate VARCHAR(32) NOT NULL,
    street VARCHAR(64) NOT NULL,
    city VARCHAR(64) NOT NULL,
    state CHAR(2) NOT NULL,
    zipcode CHAR(5) NOT NULL,
    country VARCHAR(64) NOT NULL,
    hiredate VARCHAR(32) NOT NULL,
    weeklyhours FLOAT NOT NULL,
    dentalInsurance INTEGER REFERENCES insuranceplans NOT NULL,
    medicalInsurance INTEGER REFERENCES insuranceplans NOT NULL,
    department INTEGER REFERENCES departments NOT NULL,
    fundingDept INTEGER REFERENCES departments NOT NULL,
    manager INTEGER REFERENCES employees NOT NULL,
    mentor INTEGER REFERENCES employees NOT NULL,
    hradvisor INTEGER REFERENCES employees NOT NULL,
    salary FLOAT NOT NULL,
    wage FLOAT NOT NULL,
    discriminator varchar(64) NOT NULL
};

CREATE TABLE insuranceplans {
    insid INTEGER PRIMARY KEY,
    carrier VARCHAR(64) NOT NULL,
    lifetimeOrthoBenefit DECIMAL NOT NULL,
    planType VARCHAR(8) NOT NULL,
    discriminator varchar(64) NOT NULL
};

CREATE TABLE projects {
    projid INTEGER PRIMARY KEY,
    name VARCHAR(32) NOT NULL,
    budget DECIMAL NOT NULL
};

CREATE TABLE project_reviewer {
    projid INTEGER REFERENCES projects NOT NULL,
    reviewer INTEGER REFERENCES employees NOT NULL
};

CREATE TABLE project_member {
    projid INTEGER REFERENCES projects NOT NULL,
    member INTEGER REFERENCES employees NOT NULL
};

CREATE TABLE employee_phoneno_type {
    empid INTEGER REFERENCES employees NOT NULL,
    phoneno VARCHAR(16) NOT NULL,
    type VARCHAR(16) NOT NULL
};
  • No labels