====== pears.CompanySDS ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Columns =====
^ Column ^ Type ^ Null ^ Default ^ Comment ^
| **CompanySDSID** | char(20) | NOT NULL | | |
| CompanyID | char(20) | NULL | | |
| PersonID | char(20) | NULL | | |
| IR35Status | smallint | NOT NULL | | 0 outside 1 inside |
| EmploymentID | char(20) | NULL | | Who passed the SDS |
| Reason | long varchar | NULL | | |
| WhenEntered | timestamp | NULL | current timestamp | |
| WhoEntered | char(20) | NULL | | |
===== Primary Key =====
* CompanySDSID
===== Foreign Keys =====
^ Constraint ^ Columns ^ References ^ Delete/update action ^
| company | CompanyID | [[database:tables:pears_company|pears.Company (companyid)]] | ON DELETE CASCADE |
| person | PersonID | [[database:tables:pears_person|pears.Person (personid)]] | ON DELETE CASCADE |
| employment | EmploymentID | [[database:tables:pears_employment|pears.employment (employmentid)]] | ON DELETE SET NULL |
===== Referenced By =====
* No incoming foreign keys found.
===== Indexes =====
* No indexes found.
===== Triggers =====
* No triggers found.
===== Original SQL =====
-- IQX database structure split by table
-- Source: IQXDatabaseStructure - with comments.sql
-- Table: "pears"."CompanySDS"
-- Table comment:
-- Statement count: 6
CREATE TABLE "pears"."CompanySDS" (
"CompanySDSID" char(20) NOT NULL
,"CompanyID" char(20) NULL
,"PersonID" char(20) NULL
,"IR35Status" smallint NOT NULL
,"EmploymentID" char(20) NULL
,"Reason" long varchar NULL
,"WhenEntered" timestamp NULL DEFAULT current timestamp
,"WhoEntered" char(20) NULL
,PRIMARY KEY ("CompanySDSID" ASC)
)
go
COMMENT ON COLUMN "pears"."CompanySDS"."IR35Status" IS
'0 outside 1 inside'
go
COMMENT ON COLUMN "pears"."CompanySDS"."EmploymentID" IS
'Who passed the SDS'
go
ALTER TABLE "pears"."CompanySDS"
ADD FOREIGN KEY "company" ("CompanyID" ASC)
REFERENCES "pears"."Company" ("companyid")
ON DELETE CASCADE
go
ALTER TABLE "pears"."CompanySDS"
ADD FOREIGN KEY "person" ("PersonID" ASC)
REFERENCES "pears"."Person" ("personid")
ON DELETE CASCADE
go
ALTER TABLE "pears"."CompanySDS"
ADD FOREIGN KEY "employment" ("EmploymentID" ASC)
REFERENCES "pears"."employment" ("employmentid")
ON DELETE SET NULL
go