location attributes table structure

location attributes table structure#

The Location_Attributes table holds numerical location attributes like enrolments or employment.

This table is connected to location.

Required by all models.

Table Structure#

Field

Type

NULL allowed

Default Value

Foreign key

Description

location*

INTEGER

NO

location(location)

Foreign key reference to the location this entry refers to

enrolments

REAL

YES

0

Number of enrolments. Used in school location choice.

(* - Primary key)

The SQL statement for table and index creation is below.

create TABLE IF NOT EXISTS Location_Attributes(
    location         INTEGER NOT NULL PRIMARY KEY,
    enrolments       REAL             DEFAULT 0,
   CONSTRAINT "location_fk" FOREIGN KEY("location") REFERENCES "location"("location") DEFERRABLE INITIALLY DEFERRED
);
create INDEX IF NOT EXISTS "idx_polaris_Location_Attributes_location" ON "Location_Attributes" ("location");