Skip to content

Commit

Permalink
SQL updates for the planes table (#1211)
Browse files Browse the repository at this point in the history
* SQL updates for the `planes` table

This updates `create.sql` with the schema changes that were brought in
through `clean-duplicate-planes.sql` in 36b3ee9.

Additionally, this updates `load-data.sql` to seed the DB with the data
present in `data/planes.dat`.

Resolves #1210.

* Updates to match live schema

Reference #1211 (comment).
  • Loading branch information
chrisrosset authored Jul 9, 2023
1 parent 0b8d3e8 commit 2c389c1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sql/create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,16 @@ CREATE TABLE `locales` (

DROP TABLE IF EXISTS `planes`;
CREATE TABLE `planes` (
`name` text,
`name` varchar(80),
`abbr` text,
`speed` double default NULL,
`plid` int(11) NOT NULL auto_increment,
`public` char(1) default NULL,
PRIMARY KEY (`plid`)
`public` char(1) default 'N',
`iata` text default NULL,
`icao` text default NULL,
`frequency` int(11) default 0,
PRIMARY KEY (`plid`),
UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `routes`;
Expand Down
8 changes: 8 additions & 0 deletions sql/load-data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
(name, iso_code, dafif_code);

\! echo Importing planes...
LOAD DATA LOCAL INFILE 'data/planes.dat'
REPLACE INTO TABLE planes
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
(name, iata, icao);

\! echo Importing locales...

LOAD DATA LOCAL INFILE 'locale/locales.dat'
Expand Down

0 comments on commit 2c389c1

Please sign in to comment.