micromobility docks table structure

micromobility docks table structure#

Lists all micromobility docks available in the model

Critical fields here are the operator and the number of regular and charging docks

Table Structure#

Field

Type

NULL allowed

Default Value

Foreign key

Description

dock_id*

INTEGER

YES

agency_id

INTEGER

NO

Micromobility_Agencies(agency_id)

link

INTEGER

YES

dir

INTEGER

YES

offset

REAL

YES

setback

REAL

YES

x

REAL

NO

0

y

REAL

NO

0

z

REAL

NO

0

zone

INTEGER

YES

Zone(zone)

regular_docks

INTEGER

NO

0

charging_docks

INTEGER

NO

0

name

TEXT

YES

has_parking

INTEGER

NO

0

geo

POINT

NO

‘’

(* - Primary key)

The SQL statement for table and index creation is below.

CREATE TABLE IF NOT EXISTS "Micromobility_Docks" (
    dock_id         INTEGER PRIMARY KEY AUTOINCREMENT,
    agency_id       INTEGER NOT NULL,
    "link"          INTEGER,
    dir             INTEGER,
    offset          REAL,
    setback         REAL,
    x               REAL    NOT NULL DEFAULT 0,
    y               REAL    NOT NULL DEFAULT 0,
    z               REAL    NOT NULL DEFAULT 0,
    zone            INTEGER,
    regular_docks   INTEGER NOT NULL DEFAULT 0,
    charging_docks  INTEGER NOT NULL DEFAULT 0,
    "name"          TEXT,
    has_parking     INTEGER NOT NULL DEFAULT 0,

    FOREIGN KEY(agency_id) REFERENCES Micromobility_Agencies(agency_id) deferrable initially deferred,
    FOREIGN KEY("zone") REFERENCES "Zone"("zone") deferrable initially deferred
);

select AddGeometryColumn( 'Micromobility_Docks', 'geo', SRID_PARAMETER, 'POINT', 'XY', 1);

select CreateSpatialIndex( 'Micromobility_Docks' , 'geo' );