Skip to content

Commit

Permalink
refactor: migrate from drizzle to atdatabase (#1986)
Browse files Browse the repository at this point in the history
some formatting changes occured on unrelated files
  • Loading branch information
drazisil authored Jul 8, 2024
2 parents bb0c345 + aa59d07 commit 708579d
Show file tree
Hide file tree
Showing 211 changed files with 271,069 additions and 25,446 deletions.
7 changes: 3 additions & 4 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ flags:
paths:
- packages/shared-packets/**
carryforward: true
schema:
paths:
- schema/**
carryforward: true

component_management:
individual_components:
Expand All @@ -78,3 +74,6 @@ component_management:
- packages/gateway/**
- packages/mcots/**
- packages/shared-packets/**

ignore:
- "**/__generated__/**"
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
- name: Install and test using npm
run: |
npm install
export DATABASE_URL=$(npx pg-test start)
npm run test --workspaces --if-present
npx pg-test stop
- name: Create Sentry release
uses: getsentry/action-release@586b62368d564f25d694ce05fcb9cf53de65ac4f # v1
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:
- name: Install and test
run: |
npm install
export DATABASE_URL=$(npx pg-test start)
npm test
npx pg-test stop
env:
CODECOV_UPLOAD_BUNDLE_TOKEN: ${{ secrets.CODECOV_UPLOAD_BUNDLE_TOKEN }}
- name: Codecov
Expand All @@ -49,7 +51,6 @@ jobs:
codecovcli --verbose do-upload --fail-on-error --flag shard --name shard-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag shared --name shared-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag shared-packets --name shared-packets-${{ matrix.node-version }}
codecovcli --verbose do-upload --fail-on-error --flag schema --name schema-${{ matrix.node-version }}
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: "lts/*"
node-version: 'lts/*'
- name: Install dependencies
run: pnpm install
run: npm install
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures
- name: Release
Expand Down
29 changes: 0 additions & 29 deletions .pre-commit-config.yaml

This file was deleted.

13 changes: 12 additions & 1 deletion apps/main/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ import { verifyLegacyCipherSupport } from "rusty-motors-shared";
import { getServerConfiguration } from "rusty-motors-shared";
import { getGatewayServer } from "rusty-motors-gateway";

process.on("unhandledRejection", (reason, promise) => {
console.error("Unhandled Rejection at:", promise, "reason:", reason);
Sentry.captureException(reason);
});


export default async function main() {
const coreLogger = getServerLogger({
Expand Down Expand Up @@ -98,4 +103,10 @@ export default async function main() {
}
}

await main();
try {
await main();
} catch (error) {
console.error("Error in main server:", error);
process.exit(1);

}
16 changes: 0 additions & 16 deletions drizzle.config.ts

This file was deleted.

1 change: 0 additions & 1 deletion drizzle/meta/_journal.json

This file was deleted.

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);
Loading

0 comments on commit 708579d

Please sign in to comment.