Skip to content

Commit

Permalink
Add SQL migration files for seeding various tables
Browse files Browse the repository at this point in the history
  • Loading branch information
drazisil committed Aug 19, 2024
1 parent 5e0db97 commit 525c7de
Show file tree
Hide file tree
Showing 40 changed files with 266,695 additions and 0 deletions.
8 changes: 8 additions & 0 deletions migrations/0001-createAttachmentPoint.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE
if not exists attachment_point (
attachment_point_id INTEGER NOT NULL,
attachment_point VARCHAR(100) NOT NULL,
CONSTRAINT SYS_PK_11761 PRIMARY KEY (attachment_point_id)
);

CREATE UNIQUE INDEX SYS_IDX_SYS_PK_11761_11762 ON attachment_point (attachment_point_id);
10 changes: 10 additions & 0 deletions migrations/0002-createBrand.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
create table
if not exists brand (
brand_id INTEGER NOT NULL,
brand VARCHAR(100) NULL,
pic_name VARCHAR(50) NULL,
is_stock SMALLINT default 0,
CONSTRAINT SYS_PK_11763 PRIMARY KEY (brand_id)
);

CREATE UNIQUE INDEX SYS_IDX_SYS_PK_11795_11796 ON brand (brand_id);
35 changes: 35 additions & 0 deletions migrations/0003-createModel.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
CREATE TABLE
if not exists model (
model_id INTEGER NOT NULL,
brand_id INTEGER NOT NULL,
e_model VARCHAR(100),
g_model VARCHAR(100),
f_model VARCHAR(100),
s_model VARCHAR(100),
i_model VARCHAR(100),
j_model VARCHAR(100),
sw_model VARCHAR(100),
b_model VARCHAR(100),
e_extra_info VARCHAR(100),
g_extra_info VARCHAR(100),
f_extra_info VARCHAR(100),
s_extra_info VARCHAR(100),
i_extra_info VARCHAR(100),
j_extra_info VARCHAR(100),
sw_extra_info VARCHAR(100),
b_extra_info VARCHAR(100),
e_short_model VARCHAR(50),
g_short_model VARCHAR(50),
f_short_model VARCHAR(50),
s_short_model VARCHAR(50),
i_short_model VARCHAR(50),
j_short_model VARCHAR(50),
sw_short_model VARCHAR(50),
b_short_model VARCHAR(50),
debug_string VARCHAR(255),
debug_sort_string VARCHAR(50),
CONSTRAINT SYS_PK_11927 PRIMARY KEY (model_id),
CONSTRAINT MODEL_R_172 FOREIGN KEY (brand_id) REFERENCES brand (brand_id)
);

CREATE INDEX SYS_IDX_MODEL_R_172_12422 ON model (brand_id);
40 changes: 40 additions & 0 deletions migrations/0004-createAbstractPartType.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
CREATE TABLE
IF NOT EXISTS abstract_part_type (
abstract_part_type_id INTEGER NOT NULL,
parent_abstract_part_type_id INTEGER,
depends_on INTEGER,
part_filename VARCHAR(20),
eapt VARCHAR(100) NOT NULL,
gapt VARCHAR(100),
faft VARCHAR(100),
saft VARCHAR(100),
iaft VARCHAR(100),
jaft VARCHAR(100),
sw_aft VARCHAR(100),
baft VARCHAR(100),
modified_rule INTEGER DEFAULT 0,
eut TEXT,
gut TEXT,
fut TEXT,
sut TEXT,
iut TEXT,
jut TEXT,
swut TEXT,
but TEXT,
part_paired INTEGER DEFAULT 0,
schematic_picname1 VARCHAR(9),
schematic_picname2 VARCHAR(9),
block_family_compatibility INTEGER DEFAULT 0,
repair_cost_modifier NUMERIC(100, 7) DEFAULT 0,
scrap_value_modifier NUMERIC(100, 7) DEFAULT 0,
garage_category INTEGER DEFAULT 0,
CONSTRAINT sys_pk_11740 PRIMARY KEY (abstract_part_type_id),
CONSTRAINT abstractparttype_r_191 FOREIGN KEY (depends_on) REFERENCES abstract_part_type (abstract_part_type_id),
CONSTRAINT abstractparttype_r2 FOREIGN KEY (parent_abstract_part_type_id) REFERENCES abstract_part_type (abstract_part_type_id)
);

CREATE INDEX sys_idx_abstractparttype_r_191_15170 ON abstract_part_type (depends_on);

CREATE INDEX sys_idx_abstractparttype_r2_15181 ON abstract_part_type (parent_abstract_part_type_id);

CREATE UNIQUE INDEX sys_idx_sys_pk_11740_11741 ON abstract_part_type (abstract_part_type_id);
11 changes: 11 additions & 0 deletions migrations/0005-createPartGrade.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE
IF NOT EXISTS part_grade (
part_grade_id INTEGER NOT NULL,
e_text VARCHAR(50),
g_text VARCHAR(50),
f_text VARCHAR(50),
part_grade VARCHAR(50),
CONSTRAINT sys_pk_11985 PRIMARY KEY (part_grade_id)
);

CREATE UNIQUE INDEX sys_idx_sys_pk_11985_11986 ON part_grade (part_grade_id);
17 changes: 17 additions & 0 deletions migrations/0006-createPartType.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CREATE TABLE
IF NOT EXISTS part_type (
part_type_id INTEGER NOT NULL,
abstract_part_type_id INTEGER NOT NULL,
part_type VARCHAR(100) NOT NULL,
part_filename VARCHAR(20),
part_grade_id INTEGER,
CONSTRAINT sys_pk_11991 PRIMARY KEY (part_type_id),
CONSTRAINT parttype_abstractparttypeparttype FOREIGN KEY (abstract_part_type_id) REFERENCES abstract_part_type (abstract_part_type_id),
CONSTRAINT parttype_partgradeparttype FOREIGN KEY (part_grade_id) REFERENCES part_grade (part_grade_id)
);

CREATE INDEX sys_idx_parttype_abstractparttypeparttype_12453 ON part_type (abstract_part_type_id);

CREATE INDEX sys_idx_parttype_partgradeparttype_12463 ON part_type (part_grade_id);

CREATE UNIQUE INDEX sys_idx_sys_pk_11991_11992 ON part_type (part_type_id);
22 changes: 22 additions & 0 deletions migrations/0007-createBrandedPart.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CREATE TABLE
IF NOT EXISTS branded_part (
branded_part_id INTEGER NOT NULL,
part_type_id INTEGER NOT NULL,
model_id INTEGER NOT NULL,
mfg_date TIMESTAMP NOT NULL,
qty_avail INTEGER NOT NULL,
retail_price INTEGER NOT NULL,
max_item_wear SMALLINT,
engine_block_family_id INTEGER DEFAULT 0 NOT NULL,
CONSTRAINT sys_pk_11801 PRIMARY KEY (branded_part_id),
CONSTRAINT brandedpart_modelbrandedpart FOREIGN KEY (model_id) REFERENCES model (model_id),
CONSTRAINT brandedpart_parttypebrandedpart1 FOREIGN KEY (part_type_id) REFERENCES part_type (part_type_id)
);

CREATE INDEX brandedpart_engineblockfamilyid ON branded_part (engine_block_family_id);

CREATE INDEX sys_idx_brandedpart_modelbrandedpart_12255 ON branded_part (model_id);

CREATE INDEX sys_idx_brandedpart_parttypebrandedpart1_12269 ON branded_part (part_type_id);

CREATE UNIQUE INDEX sys_idx_sys_pk_11801_11802 ON branded_part (branded_part_id);
25 changes: 25 additions & 0 deletions migrations/0008-createPart.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
CREATE TABLE
IF NOT EXISTS part (
part_id INTEGER NOT NULL,
parent_part_id INTEGER,
branded_part_id INTEGER NOT NULL,
percent_damage SMALLINT NOT NULL,
item_wear INTEGER NOT NULL,
attachment_point_id INTEGER,
owner_id INTEGER,
part_name VARCHAR(100),
repair_cost INTEGER DEFAULT 0,
scrap_value INTEGER DEFAULT 0,
CONSTRAINT sys_pk_11976 PRIMARY KEY (part_id),
CONSTRAINT part_brandedpartpart FOREIGN KEY (branded_part_id) REFERENCES branded_part (branded_part_id),
CONSTRAINT part_r25 FOREIGN KEY (parent_part_id) REFERENCES part (part_id),
CONSTRAINT part_r9 FOREIGN KEY (attachment_point_id) REFERENCES attachment_point (attachment_point_id)
);

CREATE INDEX sys_idx_part_brandedpartpart_12431 ON part (branded_part_id);

CREATE INDEX sys_idx_part_r25_15192 ON part (parent_part_id);

CREATE INDEX sys_idx_part_r9_12442 ON part (attachment_point_id);

CREATE UNIQUE INDEX sys_idx_sys_pk_11976_11977 ON part (part_id);
8 changes: 8 additions & 0 deletions migrations/0009-createDriverClass.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE
IF NOT EXISTS driver_class (
driver_class_id SMALLINT NOT NULL,
driver_class VARCHAR(50),
CONSTRAINT sys_pk_11831 PRIMARY KEY (driver_class_id)
);

CREATE UNIQUE INDEX sys_idx_sys_pk_11831_11832 ON driver_class (driver_class_id);
8 changes: 8 additions & 0 deletions migrations/0010-createPlayerType.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE
IF NOT EXISTS player_type (
player_type_id INTEGER NOT NULL,
player_type VARCHAR(100) NOT NULL,
CONSTRAINT sys_pk_12040 PRIMARY KEY (player_type_id)
);

CREATE UNIQUE INDEX sys_idx_sys_pk_12040_12041 ON player_type (player_type_id);
90 changes: 90 additions & 0 deletions migrations/0011-createPlayer.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
CREATE TABLE
IF NOT EXISTS player (
player_id INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
player_type_id INTEGER NOT NULL,
sanctioned_score INTEGER,
challenge_score INTEGER,
last_logged_in TIMESTAMP,
times_logged_in SMALLINT,
bank_balance INTEGER NOT NULL,
num_cars_owned SMALLINT NOT NULL,
is_logged_in SMALLINT,
driver_style SMALLINT NOT NULL,
lp_code INTEGER NOT NULL,
lp_text VARCHAR(9),
car_num1 VARCHAR(2) NOT NULL,
car_num2 VARCHAR(2) NOT NULL,
car_num3 VARCHAR(2) NOT NULL,
car_num4 VARCHAR(2) NOT NULL,
car_num5 VARCHAR(2) NOT NULL,
car_num6 VARCHAR(2) NOT NULL,
dl_number VARCHAR(20),
persona VARCHAR(30) NOT NULL,
"address" VARCHAR(128),
residence VARCHAR(20),
vehicle_id INTEGER,
current_race_id INTEGER,
offline_driver_skill INTEGER,
offline_grudge INTEGER,
offline_reputation INTEGER,
total_time_played INTEGER,
car_info_setting INTEGER,
stock_classic_class SMALLINT,
stock_muscle_class SMALLINT,
modified_classic_class SMALLINT,
modified_muscle_class SMALLINT,
outlaw_class SMALLINT,
drag_class SMALLINT,
challenge_rung INTEGER,
offline_ai_car_class SMALLINT DEFAULT 0,
offline_ai_skin_id INTEGER DEFAULT 0,
offline_ai_car_bpt_id INTEGER DEFAULT 0,
offline_ai_state SMALLINT DEFAULT 0,
body_type INTEGER DEFAULT 0,
skin_color INTEGER DEFAULT 0,
hair_color INTEGER DEFAULT 0,
shirt_color INTEGER DEFAULT 0,
pants_color INTEGER DEFAULT 0,
offline_driver_style INTEGER,
offline_driver_attitude INTEGER,
evaded_fuzz INTEGER DEFAULT 0,
pinks_won INTEGER DEFAULT 0,
num_unread_mail INTEGER DEFAULT 0,
total_races_run INTEGER DEFAULT 0,
total_races_won INTEGER DEFAULT 0,
total_races_completed INTEGER DEFAULT 0,
total_winnings INTEGER DEFAULT 0,
insurance_risk_points INTEGER DEFAULT 0,
insurance_rating INTEGER DEFAULT 0,
challenge_races_run INTEGER DEFAULT 0,
challenge_races_won INTEGER DEFAULT 0,
challenge_races_completed INTEGER DEFAULT 0,
cars_lost INTEGER DEFAULT 0,
cars_won INTEGER DEFAULT 0,
CONSTRAINT sys_pk_12021 PRIMARY KEY ("player_id"),
CONSTRAINT player_driverclassplayer1 FOREIGN KEY (stock_muscle_class) REFERENCES driver_class (driver_class_id),
CONSTRAINT player_driverclassplayer2 FOREIGN KEY (modified_classic_class) REFERENCES driver_class (driver_class_id),
CONSTRAINT player_driverclassplayer3 FOREIGN KEY (modified_muscle_class) REFERENCES driver_class (driver_class_id),
CONSTRAINT player_driverclassplayer4 FOREIGN KEY (outlaw_class) REFERENCES driver_class (driver_class_id),
CONSTRAINT player_driverclassplayer5 FOREIGN KEY (drag_class) REFERENCES driver_class (driver_class_id),
CONSTRAINT player_r44 FOREIGN KEY (player_type_id) REFERENCES player_type (player_type_id)
);

CREATE INDEX IF NOT EXISTS player_numunreadmail ON player (num_unread_mail);

CREATE INDEX IF NOT EXISTS player_offlinechallengecarbptid ON player (offline_ai_car_bpt_id);

CREATE INDEX IF NOT EXISTS sys_idx_player_driverclassplayer1_12502 ON player (stock_muscle_class);

CREATE INDEX IF NOT EXISTS sys_idx_player_driverclassplayer2_12523 ON player (modified_classic_class);

CREATE INDEX IF NOT EXISTS sys_idx_player_driverclassplayer3_12544 ON player (modified_muscle_class);

CREATE INDEX IF NOT EXISTS sys_idx_player_driverclassplayer4_12565 ON player (outlaw_class);

CREATE INDEX IF NOT EXISTS sys_idx_player_driverclassplayer5_12586 ON player (drag_class);

CREATE INDEX IF NOT EXISTS sys_idx_player_r44_12607 ON player (player_type_id);

CREATE UNIQUE INDEX IF NOT EXISTS sys_idx_sys_pk_12021_12022 ON player (player_id);
8 changes: 8 additions & 0 deletions migrations/0012-createSkinType.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE
IF NOT EXISTS skin_type (
skin_type_id INTEGER NOT NULL,
skin_type VARCHAR(100),
CONSTRAINT sys_pk_12138 PRIMARY KEY (skin_type_id)
);

CREATE UNIQUE INDEX sys_idx_sys_pk_12138_12139 ON skin_type (skin_type_id);
77 changes: 77 additions & 0 deletions migrations/0013-createPtSkin.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
CREATE TABLE
IF NOT EXISTS pt_skin (
skin_id INTEGER NOT NULL,
creator_id INTEGER,
skin_type_id INTEGER,
part_type_id INTEGER,
e_skin VARCHAR(100),
g_skin VARCHAR(20),
f_skin VARCHAR(20),
s_skin VARCHAR(20),
i_skin VARCHAR(20),
j_skin VARCHAR(20),
sw_skin VARCHAR(20),
b_skin VARCHAR(20),
price INTEGER NOT NULL,
part_filename VARCHAR(20),
h0 SMALLINT,
s0 SMALLINT,
v0 SMALLINT,
c0 SMALLINT,
x0 SMALLINT,
y0 SMALLINT,
h1 SMALLINT,
s1 SMALLINT,
v1 SMALLINT,
c1 SMALLINT,
x1 SMALLINT,
y1 SMALLINT,
h2 SMALLINT,
s2 SMALLINT,
v2 SMALLINT,
c2 SMALLINT,
x2 SMALLINT,
y2 SMALLINT,
h3 SMALLINT,
s3 SMALLINT,
v3 SMALLINT,
c3 SMALLINT,
x3 SMALLINT,
y3 SMALLINT,
h4 SMALLINT,
s4 SMALLINT,
v4 SMALLINT,
c4 SMALLINT,
x4 SMALLINT,
y4 SMALLINT,
h5 SMALLINT,
s5 SMALLINT,
v5 SMALLINT,
c5 SMALLINT,
x5 SMALLINT,
y5 SMALLINT,
h6 SMALLINT,
s6 SMALLINT,
v6 SMALLINT,
c6 SMALLINT,
x6 SMALLINT,
y6 SMALLINT,
h7 SMALLINT,
s7 SMALLINT,
v7 SMALLINT,
c7 SMALLINT,
x7 SMALLINT,
y7 SMALLINT,
default_flag INTEGER DEFAULT 0,
creator_name VARCHAR(24),
comment_text VARCHAR(128),
CONSTRAINT sys_pk_12047 PRIMARY KEY (skin_id),
CONSTRAINT pt_skin_part_type_pt_skin FOREIGN KEY (part_type_id) REFERENCES part_type (part_type_id),
CONSTRAINT pt_skin_skin_type_pt_skin FOREIGN KEY (skin_type_id) REFERENCES skin_type (skin_type_id)
);

CREATE INDEX sys_idx_pt_skin_part_type_pt_skin_12628 ON pt_skin (part_type_id);

CREATE INDEX sys_idx_pt_skin_skin_type_pt_skin_12636 ON pt_skin (skin_type_id);

CREATE UNIQUE INDEX sys_idx_sys_pk_12047_12048 ON pt_skin (skin_id);
Loading

0 comments on commit 525c7de

Please sign in to comment.