move first semester to first semester

This commit is contained in:
Motiejus Jakštys
2020-04-08 22:49:30 +03:00
parent db18a17f66
commit b97b04e9bb
93 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
-- schema
CREATE TABLE airports (
gid SERIAL NOT NULL PRIMARY KEY,
name TEXT,
city TEXT,
country TEXT,
iata TEXT,
icao TEXT,
geom GEOMETRY,
latitude DOUBLE PRECISION,
longitude DOUBLE PRECISION,
altitude DOUBLE PRECISION,
timezone TEXT,
dst TEXT,
tz TEXT,
type TEXT,
source TEXT,
CONSTRAINT enforce_dims_geom CHECK (st_ndims(geom) = 3),
CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) = 'POINT'::text OR geom IS NULL),
CONSTRAINT enforce_srid_geom CHECK (st_srid(geom) = 4326)
);
-- create index for faster spatial lookups
CREATE INDEX idx_geom ON airports USING GIN (geom);
-- import data from airports.dat
\copy airports(gid, name, city, country, iata, icao, latitude, longitude, altitude, timezone, dst, tz, type, source) FROM 'airports.dat' DELIMITERS ',' CSV;
-- put lat/lon/altitude to the "real" geom field
UPDATE airports
SET geom = ST_SetSRID(ST_MakePoint(longitude, latitude, altitude * 0.3048),4326);
ALTER TABLE airports DROP COLUMN latitude;
ALTER TABLE airports DROP COLUMN longitude;
ALTER TABLE airports DROP COLUMN altitude;
ALTER TABLE airports DROP COLUMN type;
ALTER TABLE airports DROP COLUMN source;