Skip to content

Commit

Permalink
upgrade drizzle-kit and drizzle-orm
Browse files Browse the repository at this point in the history
drizzle-orm: 0.31.1 -> 0.36.1
drizzle-kit: 0.22.2 -> 0.28.0
refactor deprecated methods and objects

closes #386
  • Loading branch information
TangoYankee committed Nov 26, 2024
1 parent c1dc09c commit 41af1e4
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 100 deletions.
6 changes: 3 additions & 3 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Drizzle kit configuration
import type { Config } from "drizzle-kit";
import { defineConfig } from "drizzle-kit";

export default {
export default defineConfig({
schema: "./src/schema/*",
dialect: "postgresql",
out: "db/migration",
Expand All @@ -15,4 +15,4 @@ export default {
rejectUnauthorized: false,
},
},
} satisfies Config;
});
32 changes: 22 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.4.5",
"@nestjs/serve-static": "^4.0.0",
"drizzle-orm": "^0.31.1",
"drizzle-orm": "^0.36.1",
"immer": "^10.1.1",
"joi": "^17.11.0",
"pg": "^8.11.3",
Expand Down Expand Up @@ -64,7 +64,7 @@
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"dotenv": "^16.3.1",
"drizzle-kit": "^0.22.2",
"drizzle-kit": "^0.28.0",
"esbuild": "^0.21.2",
"eslint": "^8.42.0",
"eslint-config-prettier": "^9.0.0",
Expand Down Expand Up @@ -112,4 +112,4 @@
"npm run lint"
]
}
}
}
2 changes: 0 additions & 2 deletions src/drizzle-pgis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@ export {
multiPolygonGeog,
geometryCollectionGeog,
} from "./geography";

export { ST_AsGeoJSON } from "./spatial-type";
23 changes: 0 additions & 23 deletions src/drizzle-pgis/spatial-type.ts

This file was deleted.

6 changes: 1 addition & 5 deletions src/schema/budget-line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ export const budgetLine = pgTable(
code: text("code").references(() => agencyBudget.code),
id: text("id"),
},
(table) => {
return {
pk: primaryKey({ columns: [table.code, table.id] }),
};
},
(table) => [primaryKey({ columns: [table.code, table.id] })],
);

export const budgetLineEntitySchema = z.object({
Expand Down
22 changes: 10 additions & 12 deletions src/schema/capital-commitment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ export const capitalCommitment = pgTable(
budgetLineCode: text("budget_line_code").notNull(),
budgetLineId: text("budget_line_id").notNull(),
},
(table) => {
return {
capitalProjectFk: foreignKey({
columns: [table.managingCode, table.capitalProjectId],
foreignColumns: [capitalProject.managingCode, capitalProject.id],
}),
budgetLineFk: foreignKey({
columns: [table.budgetLineCode, table.budgetLineId],
foreignColumns: [budgetLine.code, budgetLine.id],
}),
};
},
(table) => [
foreignKey({
columns: [table.managingCode, table.capitalProjectId],
foreignColumns: [capitalProject.managingCode, capitalProject.id],
}),
foreignKey({
columns: [table.budgetLineCode, table.budgetLineId],
foreignColumns: [budgetLine.code, budgetLine.id],
}),
],
);

export const capitalCommitmentEntitySchema = z.object({
Expand Down
16 changes: 7 additions & 9 deletions src/schema/capital-project-checkbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ export const capitalProjectCheckbook = pgTable(
capitalProjectId: text("capital_project_id"),
value: numeric("value"),
},
(table) => {
return {
fk: foreignKey({
columns: [table.managingCode, table.capitalProjectId],
foreignColumns: [capitalProject.managingCode, capitalProject.id],
name: "custom_fk",
}),
};
},
(table) => [
foreignKey({
columns: [table.managingCode, table.capitalProjectId],
foreignColumns: [capitalProject.managingCode, capitalProject.id],
name: "custom_fk",
}),
],
);

export const capitalProjectCategoryEntitySchema = z.object({
Expand Down
16 changes: 7 additions & 9 deletions src/schema/capital-project-fund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ export const capitalProjectFund = pgTable(
stage: capitalProjectFundStageEnum("stage"),
value: numeric("value"),
},
(table) => {
return {
fk: foreignKey({
columns: [table.managingCode, table.capitalProjectId],
foreignColumns: [capitalProject.managingCode, capitalProject.id],
name: "custom_fk",
}),
};
},
(table) => [
foreignKey({
columns: [table.managingCode, table.capitalProjectId],
foreignColumns: [capitalProject.managingCode, capitalProject.id],
name: "custom_fk",
}),
],
);

export const capitalProjectFundEntitySchema = z.object({
Expand Down
16 changes: 7 additions & 9 deletions src/schema/capital-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ export const capitalProject = pgTable(
mercatorFillMPnt: multiPointGeom("mercator_fill_m_pnt", 3857),
mercatorFillMPoly: multiPolygonGeom("mercator_fill_m_poly", 3857),
},
(table) => {
return {
pk: primaryKey({ columns: [table.managingCode, table.id] }),
mercatorFillMPolyGix: index().using("GIST", table.mercatorFillMPoly),
mercatorFillMPntGix: index().using("GIST", table.mercatorFillMPnt),
liFtMPntGix: index().using("GIST", table.liFtMPnt),
liFtMPolyGix: index().using("GIST", table.liFtMPoly),
};
},
(table) => [
primaryKey({ columns: [table.managingCode, table.id] }),
index().using("GIST", table.mercatorFillMPoly),
index().using("GIST", table.mercatorFillMPnt),
index().using("GIST", table.liFtMPnt),
index().using("GIST", table.liFtMPoly),
],
);

export const capitalProjectCategoryEnumSchema = z.enum([
Expand Down
12 changes: 5 additions & 7 deletions src/schema/city-council-district.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ export const cityCouncilDistrict = pgTable(
mercatorFill: multiPolygonGeom("mercator_fill", 3857),
mercatorLabel: pointGeom("mercator_label", 3857),
},
(table) => {
return {
mercatorFillGix: index().using("GIST", table.mercatorFill),
mercatorLabelGix: index().using("GIST", table.mercatorLabel),
liFtGix: index().using("GIST", table.liFt),
};
},
(table) => [
index().using("GIST", table.mercatorFill),
index().using("GIST", table.mercatorLabel),
index().using("GIST", table.liFt),
],
);

export const cityCouncilDistrictEntitySchema = z.object({
Expand Down
14 changes: 6 additions & 8 deletions src/schema/community-district.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ export const communityDistrict = pgTable(
mercatorFill: multiPolygonGeom("mercator_fill", 3857),
mercatorLabel: pointGeom("mercator_label", 3857),
},
(table) => {
return {
pk: primaryKey({ columns: [table.boroughId, table.id] }),
liFtGix: index().using("GIST", table.liFt),
mercatorFillGix: index().using("GIST", table.mercatorFill),
mercatorLabelGix: index().using("GIST", table.mercatorLabel),
};
},
(table) => [
primaryKey({ columns: [table.boroughId, table.id] }),
index().using("GIST", table.liFt),
index().using("GIST", table.mercatorFill),
index().using("GIST", table.mercatorLabel),
],
);

export const communityDistrictEntitySchema = z.object({
Expand Down

0 comments on commit 41af1e4

Please sign in to comment.