stashing code
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
CREATE TABLE IF NOT EXISTS "airport" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"type" varchar(64) NOT NULL,
|
||||
"name" varchar(128) NOT NULL,
|
||||
"gps_code" varchar(64) NOT NULL,
|
||||
"ident" varchar(128),
|
||||
"latitude_deg" numeric(10, 2),
|
||||
"longitude_deg" numeric(10, 2),
|
||||
"elevation_ft" numeric(10, 2),
|
||||
"continent" varchar(64),
|
||||
"country" varchar(172),
|
||||
"iso_country" varchar(4) NOT NULL,
|
||||
"iso_region" varchar(64) NOT NULL,
|
||||
"municipality" varchar(64),
|
||||
"scheduled_service" varchar(64),
|
||||
"iata_code" varchar(16) NOT NULL,
|
||||
"local_code" varchar(16) NOT NULL,
|
||||
"created_at" timestamp DEFAULT now(),
|
||||
"updated_at" timestamp DEFAULT now(),
|
||||
"search_vector" "tsvector" GENERATED ALWAYS AS (
|
||||
setweight(to_tsvector('english', coalesce("airport"."name", '')), 'A') ||
|
||||
setweight(to_tsvector('english', coalesce("airport"."iata_code", '')), 'A') ||
|
||||
setweight(to_tsvector('english', coalesce("airport"."municipality", '')), 'B') ||
|
||||
setweight(to_tsvector('english', coalesce("airport"."country", '')), 'C')
|
||||
) STORED
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX IF NOT EXISTS "name_idx" ON "airport" USING btree ("name");--> statement-breakpoint
|
||||
CREATE INDEX IF NOT EXISTS "gps_code_idx" ON "airport" USING btree ("gps_code");--> statement-breakpoint
|
||||
CREATE INDEX IF NOT EXISTS "search_vector_idx" ON "airport" USING gin ("search_vector");
|
||||
@@ -0,0 +1,16 @@
|
||||
-- Custom SQL migration file, put your code below! --
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS pg_trgm;
|
||||
CREATE EXTENSION IF NOT EXISTS btree_gin;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "trgm_idx_airport_name"
|
||||
ON airport USING gin ("name" gin_trgm_ops);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "trgm_idx_airport_iatacode"
|
||||
ON airport USING gin ("iata_code" gin_trgm_ops);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "trgm_idx_airport_municipality"
|
||||
ON airport USING gin ("municipality" gin_trgm_ops);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "trgm_idx_airport_country"
|
||||
ON airport USING gin ("country" gin_trgm_ops);
|
||||
198
packages/airportsdb/migrations/meta/0000_snapshot.json
Normal file
198
packages/airportsdb/migrations/meta/0000_snapshot.json
Normal file
@@ -0,0 +1,198 @@
|
||||
{
|
||||
"id": "2202b3d8-281c-474f-903d-27296ca06458",
|
||||
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
"tables": {
|
||||
"public.airport": {
|
||||
"name": "airport",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "serial",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"type": {
|
||||
"name": "type",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "varchar(128)",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"gps_code": {
|
||||
"name": "gps_code",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"ident": {
|
||||
"name": "ident",
|
||||
"type": "varchar(128)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"latitude_deg": {
|
||||
"name": "latitude_deg",
|
||||
"type": "numeric(10, 2)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"longitude_deg": {
|
||||
"name": "longitude_deg",
|
||||
"type": "numeric(10, 2)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"elevation_ft": {
|
||||
"name": "elevation_ft",
|
||||
"type": "numeric(10, 2)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"continent": {
|
||||
"name": "continent",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"country": {
|
||||
"name": "country",
|
||||
"type": "varchar(172)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"iso_country": {
|
||||
"name": "iso_country",
|
||||
"type": "varchar(4)",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"iso_region": {
|
||||
"name": "iso_region",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"municipality": {
|
||||
"name": "municipality",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"scheduled_service": {
|
||||
"name": "scheduled_service",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"iata_code": {
|
||||
"name": "iata_code",
|
||||
"type": "varchar(16)",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"local_code": {
|
||||
"name": "local_code",
|
||||
"type": "varchar(16)",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"created_at": {
|
||||
"name": "created_at",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"updated_at": {
|
||||
"name": "updated_at",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"search_vector": {
|
||||
"name": "search_vector",
|
||||
"type": "tsvector",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"generated": {
|
||||
"as": "\n setweight(to_tsvector('english', coalesce(\"airport\".\"name\", '')), 'A') ||\n setweight(to_tsvector('english', coalesce(\"airport\".\"iata_code\", '')), 'A') ||\n setweight(to_tsvector('english', coalesce(\"airport\".\"municipality\", '')), 'B') ||\n setweight(to_tsvector('english', coalesce(\"airport\".\"country\", '')), 'C')\n ",
|
||||
"type": "stored"
|
||||
}
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"name_idx": {
|
||||
"name": "name_idx",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "name",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": false,
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
},
|
||||
"gps_code_idx": {
|
||||
"name": "gps_code_idx",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "gps_code",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": false,
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
},
|
||||
"search_vector_idx": {
|
||||
"name": "search_vector_idx",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "search_vector",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": false,
|
||||
"concurrently": false,
|
||||
"method": "gin",
|
||||
"with": {}
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
}
|
||||
},
|
||||
"enums": {},
|
||||
"schemas": {},
|
||||
"sequences": {},
|
||||
"roles": {},
|
||||
"policies": {},
|
||||
"views": {},
|
||||
"_meta": {
|
||||
"columns": {},
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
198
packages/airportsdb/migrations/meta/0001_snapshot.json
Normal file
198
packages/airportsdb/migrations/meta/0001_snapshot.json
Normal file
@@ -0,0 +1,198 @@
|
||||
{
|
||||
"id": "864dcba9-6d53-4311-be3e-0a51a483dac2",
|
||||
"prevId": "2202b3d8-281c-474f-903d-27296ca06458",
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
"tables": {
|
||||
"public.airport": {
|
||||
"name": "airport",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "serial",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"type": {
|
||||
"name": "type",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "varchar(128)",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"gps_code": {
|
||||
"name": "gps_code",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"ident": {
|
||||
"name": "ident",
|
||||
"type": "varchar(128)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"latitude_deg": {
|
||||
"name": "latitude_deg",
|
||||
"type": "numeric(10, 2)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"longitude_deg": {
|
||||
"name": "longitude_deg",
|
||||
"type": "numeric(10, 2)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"elevation_ft": {
|
||||
"name": "elevation_ft",
|
||||
"type": "numeric(10, 2)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"continent": {
|
||||
"name": "continent",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"country": {
|
||||
"name": "country",
|
||||
"type": "varchar(172)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"iso_country": {
|
||||
"name": "iso_country",
|
||||
"type": "varchar(4)",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"iso_region": {
|
||||
"name": "iso_region",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"municipality": {
|
||||
"name": "municipality",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"scheduled_service": {
|
||||
"name": "scheduled_service",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"iata_code": {
|
||||
"name": "iata_code",
|
||||
"type": "varchar(16)",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"local_code": {
|
||||
"name": "local_code",
|
||||
"type": "varchar(16)",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"created_at": {
|
||||
"name": "created_at",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"updated_at": {
|
||||
"name": "updated_at",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"search_vector": {
|
||||
"name": "search_vector",
|
||||
"type": "tsvector",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"generated": {
|
||||
"type": "stored",
|
||||
"as": "\n setweight(to_tsvector('english', coalesce(\"airport\".\"name\", '')), 'A') ||\n setweight(to_tsvector('english', coalesce(\"airport\".\"iata_code\", '')), 'A') ||\n setweight(to_tsvector('english', coalesce(\"airport\".\"municipality\", '')), 'B') ||\n setweight(to_tsvector('english', coalesce(\"airport\".\"country\", '')), 'C')\n "
|
||||
}
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"name_idx": {
|
||||
"name": "name_idx",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "name",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": false,
|
||||
"with": {},
|
||||
"method": "btree",
|
||||
"concurrently": false
|
||||
},
|
||||
"gps_code_idx": {
|
||||
"name": "gps_code_idx",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "gps_code",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": false,
|
||||
"with": {},
|
||||
"method": "btree",
|
||||
"concurrently": false
|
||||
},
|
||||
"search_vector_idx": {
|
||||
"name": "search_vector_idx",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "search_vector",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": false,
|
||||
"with": {},
|
||||
"method": "gin",
|
||||
"concurrently": false
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
}
|
||||
},
|
||||
"enums": {},
|
||||
"schemas": {},
|
||||
"views": {},
|
||||
"sequences": {},
|
||||
"roles": {},
|
||||
"policies": {},
|
||||
"_meta": {
|
||||
"columns": {},
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
20
packages/airportsdb/migrations/meta/_journal.json
Normal file
20
packages/airportsdb/migrations/meta/_journal.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
"entries": [
|
||||
{
|
||||
"idx": 0,
|
||||
"version": "7",
|
||||
"when": 1746008605929,
|
||||
"tag": "0000_friendly_thunderbolts",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 1,
|
||||
"version": "7",
|
||||
"when": 1746008876617,
|
||||
"tag": "0001_military_hannibal_king",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user