====== pears.StatusHistory ======
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 ^
| **StatusHistoryID** | char(20) | NOT NULL | | |
| PersonID | char(20) | NULL | | |
| CompanyID | char(20) | NULL | | |
| IsSales | tinyint | NOT NULL | 0 | |
| VacancyID | char(20) | NULL | | |
| OldStatus | char(20) | NULL | | |
| NewStatus | char(20) | NULL | | |
| WhenEntered | timestamp | NOT NULL | current timestamp | |
| StaffID | char(20) | NULL | | |
===== Primary Key =====
* StatusHistoryID
===== Foreign Keys =====
^ Constraint ^ Columns ^ References ^ Delete/update action ^
| Person | PersonID | [[database:tables:pears_person|pears.Person (personid)]] | ON DELETE CASCADE |
| Company | CompanyID | [[database:tables:pears_company|pears.Company (companyid)]] | ON DELETE CASCADE |
| Vacancy | VacancyID | [[database:tables:pears_vacancy|pears.vacancy (vacancyid)]] | ON DELETE CASCADE |
| Staff | StaffID | [[database:tables:pears_staff|pears.staff (staffid)]] | ON DELETE CASCADE |
===== 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"."StatusHistory"
-- Table comment:
-- Statement count: 5
CREATE TABLE "pears"."StatusHistory" (
"StatusHistoryID" char(20) NOT NULL
,"PersonID" char(20) NULL
,"CompanyID" char(20) NULL
,"IsSales" tinyint NOT NULL DEFAULT 0
,"VacancyID" char(20) NULL
,"OldStatus" char(20) NULL
,"NewStatus" char(20) NULL
,"WhenEntered" timestamp NOT NULL DEFAULT current timestamp
,"StaffID" char(20) NULL
,PRIMARY KEY ("StatusHistoryID" ASC)
)
go
ALTER TABLE "pears"."StatusHistory"
ADD FOREIGN KEY "Person" ("PersonID" ASC)
REFERENCES "pears"."Person" ("personid")
ON DELETE CASCADE
go
ALTER TABLE "pears"."StatusHistory"
ADD FOREIGN KEY "Company" ("CompanyID" ASC)
REFERENCES "pears"."Company" ("companyid")
ON DELETE CASCADE
go
ALTER TABLE "pears"."StatusHistory"
ADD FOREIGN KEY "Vacancy" ("VacancyID" ASC)
REFERENCES "pears"."vacancy" ("vacancyid")
ON DELETE CASCADE
go
ALTER TABLE "pears"."StatusHistory"
ADD FOREIGN KEY "Staff" ("StaffID" ASC)
REFERENCES "pears"."staff" ("staffid")
ON DELETE CASCADE
go