mirror of
https://github.com/twentyhq/twenty
synced 2026-04-21 13:37:22 +00:00
Update dizzle-kit and drizzle-orm to avoid the dependency on Hono. (#15343)
Updated both drizzle-kit and drizzle-orm to the latest versions. Process: - Ran migrations on the database. - Updated the versions. - Made the required changes to `drizzle-posgres.config.ts`. - Ensured migrations are not out of sync be running them again - no issues, no updates applied. - Updated the snapshots. - Deleted the database named `website`. - Re-ran the migrations to confirm. There are no breaking changes because the surface drizzle-orm covers is limited. However, we had to update drizzle-orm in order to update drizzle-kit to a version greater than 0.27.0 in order to avoid the use of hono. Therefore, I went ahead and updated both to the latest. Resolves [Dependabot Alert #274](https://github.com/twentyhq/twenty/security/dependabot/274) and three others.
This commit is contained in:
parent
a8d35cb831
commit
f7a80d250b
7 changed files with 534 additions and 573 deletions
|
|
@ -17,7 +17,6 @@
|
|||
"date-fns": "^2.30.0",
|
||||
"date-fns-tz": "^2.0.0",
|
||||
"deep-equal": "^2.2.2",
|
||||
"drizzle-orm": "^0.29.3",
|
||||
"file-type": "16.5.4",
|
||||
"framer-motion": "^11.18.0",
|
||||
"fuse.js": "^7.1.0",
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
"github:sync": "npx tsx src/github/github-sync.ts",
|
||||
"github:init": "npx tsx src/github/github-sync.ts --isFullSync",
|
||||
"database:migrate": "npx tsx src/database/migrate-database.ts",
|
||||
"database:generate:pg": "npx drizzle-kit generate:pg --config=src/database/drizzle-posgres.config.ts"
|
||||
"database:generate:pg": "npx drizzle-kit generate --config=src/database/drizzle-posgres.config.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@codesandbox/sandpack-react": "^2.13.5",
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
"@markdoc/markdoc": "^0.5.1",
|
||||
"@nivo/calendar": "^0.99.0",
|
||||
"date-fns": "^2.30.0",
|
||||
"drizzle-kit": "^0.20.14",
|
||||
"drizzle-orm": "^0.44.7",
|
||||
"facepaint": "^1.2.1",
|
||||
"gray-matter": "^4.0.3",
|
||||
"next": "^14.2.25",
|
||||
|
|
@ -33,6 +33,7 @@
|
|||
"devDependencies": {
|
||||
"@next/eslint-plugin-next": "^14.2.0",
|
||||
"@types/facepaint": "^1.2.5",
|
||||
"drizzle-kit": "^0.31.5",
|
||||
"eslint-config-next": "^14.2.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,14 +2,15 @@ import { global } from '@apollo/client/utilities/globals';
|
|||
import { drizzle, type PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
||||
import { migrate as postgresMigrate } from 'drizzle-orm/postgres-js/migrator';
|
||||
import postgres from 'postgres';
|
||||
import * as schema from './schema-postgres';
|
||||
|
||||
import 'dotenv/config';
|
||||
|
||||
let pgDb: PostgresJsDatabase;
|
||||
let pgDb: PostgresJsDatabase<typeof schema>;
|
||||
|
||||
if (global.process.env.DATABASE_PG_URL) {
|
||||
const pgClient = postgres(`${global.process.env.DATABASE_PG_URL}`);
|
||||
pgDb = drizzle(pgClient, { logger: false });
|
||||
pgDb = drizzle(pgClient, { schema, logger: false });
|
||||
}
|
||||
|
||||
const migrate = async () => {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,17 @@
|
|||
import { type Config } from 'drizzle-kit';
|
||||
import "dotenv/config";
|
||||
import { type Config } from "drizzle-kit";
|
||||
|
||||
import 'dotenv/config';
|
||||
const dbUrl = new URL(process.env.DATABASE_PG_URL!);
|
||||
|
||||
const pgConfig = {
|
||||
schema: './src/database/schema-postgres.ts',
|
||||
out: './src/database/migrations',
|
||||
driver: 'pg',
|
||||
export default {
|
||||
schema: "./src/database/schema-postgres.ts",
|
||||
out: "./src/database/migrations",
|
||||
dialect: "postgresql",
|
||||
dbCredentials: {
|
||||
connectionString: process.env.DATABASE_PG_URL ?? '',
|
||||
host: dbUrl.hostname,
|
||||
port: Number(dbUrl.port),
|
||||
user: dbUrl.username,
|
||||
password: dbUrl.password,
|
||||
database: dbUrl.pathname.slice(1),
|
||||
},
|
||||
} satisfies Config;
|
||||
|
||||
export default pgConfig;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
{
|
||||
"id": "a7895a79-44a3-4fad-b750-f89d8c04d85c",
|
||||
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||
"version": "5",
|
||||
"dialect": "pg",
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
"tables": {
|
||||
"issueLabels": {
|
||||
"public.issueLabels": {
|
||||
"name": "issueLabels",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
|
|
@ -26,26 +24,37 @@
|
|||
"issueLabels_issueId_issues_id_fk": {
|
||||
"name": "issueLabels_issueId_issues_id_fk",
|
||||
"tableFrom": "issueLabels",
|
||||
"columnsFrom": [
|
||||
"issueId"
|
||||
],
|
||||
"tableTo": "issues",
|
||||
"columnsFrom": ["issueId"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "no action",
|
||||
"onDelete": "no action"
|
||||
},
|
||||
"issueLabels_labelId_labels_id_fk": {
|
||||
"name": "issueLabels_labelId_labels_id_fk",
|
||||
"tableFrom": "issueLabels",
|
||||
"columnsFrom": [
|
||||
"labelId"
|
||||
],
|
||||
"tableTo": "labels",
|
||||
"columnsFrom": ["labelId"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "no action",
|
||||
"onDelete": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"isRLSEnabled": false,
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"issues": {
|
||||
"public.issues": {
|
||||
"name": "issues",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
|
|
@ -109,17 +118,24 @@
|
|||
"issues_authorId_users_id_fk": {
|
||||
"name": "issues_authorId_users_id_fk",
|
||||
"tableFrom": "issues",
|
||||
"columnsFrom": [
|
||||
"authorId"
|
||||
],
|
||||
"tableTo": "users",
|
||||
"columnsFrom": ["authorId"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "no action",
|
||||
"onDelete": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"isRLSEnabled": false,
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"labels": {
|
||||
"public.labels": {
|
||||
"name": "labels",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
|
|
@ -157,9 +173,12 @@
|
|||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"isRLSEnabled": false,
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"pullRequestLabels": {
|
||||
"public.pullRequestLabels": {
|
||||
"name": "pullRequestLabels",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
|
|
@ -181,26 +200,37 @@
|
|||
"pullRequestLabels_pullRequestExternalId_pullRequests_id_fk": {
|
||||
"name": "pullRequestLabels_pullRequestExternalId_pullRequests_id_fk",
|
||||
"tableFrom": "pullRequestLabels",
|
||||
"columnsFrom": [
|
||||
"pullRequestExternalId"
|
||||
],
|
||||
"tableTo": "pullRequests",
|
||||
"columnsFrom": ["pullRequestExternalId"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "no action",
|
||||
"onDelete": "no action"
|
||||
},
|
||||
"pullRequestLabels_labelId_labels_id_fk": {
|
||||
"name": "pullRequestLabels_labelId_labels_id_fk",
|
||||
"tableFrom": "pullRequestLabels",
|
||||
"columnsFrom": [
|
||||
"labelId"
|
||||
],
|
||||
"tableTo": "labels",
|
||||
"columnsFrom": ["labelId"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "no action",
|
||||
"onDelete": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"isRLSEnabled": false,
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"pullRequests": {
|
||||
"public.pullRequests": {
|
||||
"name": "pullRequests",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
|
|
@ -264,17 +294,24 @@
|
|||
"pullRequests_authorId_users_id_fk": {
|
||||
"name": "pullRequests_authorId_users_id_fk",
|
||||
"tableFrom": "pullRequests",
|
||||
"columnsFrom": [
|
||||
"authorId"
|
||||
],
|
||||
"tableTo": "users",
|
||||
"columnsFrom": ["authorId"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "no action",
|
||||
"onDelete": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"isRLSEnabled": false,
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"users": {
|
||||
"public.users": {
|
||||
"name": "users",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
|
|
@ -306,14 +343,23 @@
|
|||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"isRLSEnabled": false,
|
||||
"checkConstraints": {}
|
||||
}
|
||||
},
|
||||
"enums": {},
|
||||
"schemas": {},
|
||||
"_meta": {
|
||||
"columns": {},
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
"tables": {},
|
||||
"columns": {}
|
||||
},
|
||||
"id": "a7895a79-44a3-4fad-b750-f89d8c04d85c",
|
||||
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||
"sequences": {},
|
||||
"policies": {},
|
||||
"views": {},
|
||||
"roles": {}
|
||||
}
|
||||
|
|
@ -1,10 +1,8 @@
|
|||
{
|
||||
"id": "b3a89784-eb82-49d8-b081-31c49e6906dc",
|
||||
"prevId": "a7895a79-44a3-4fad-b750-f89d8c04d85c",
|
||||
"version": "5",
|
||||
"dialect": "pg",
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
"tables": {
|
||||
"githubReleases": {
|
||||
"public.githubReleases": {
|
||||
"name": "githubReleases",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
|
|
@ -24,9 +22,12 @@
|
|||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"isRLSEnabled": false,
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"githubStars": {
|
||||
"public.githubStars": {
|
||||
"name": "githubStars",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
|
|
@ -47,9 +48,12 @@
|
|||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"isRLSEnabled": false,
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"issueLabels": {
|
||||
"public.issueLabels": {
|
||||
"name": "issueLabels",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
|
|
@ -71,26 +75,37 @@
|
|||
"issueLabels_issueId_issues_id_fk": {
|
||||
"name": "issueLabels_issueId_issues_id_fk",
|
||||
"tableFrom": "issueLabels",
|
||||
"columnsFrom": [
|
||||
"issueId"
|
||||
],
|
||||
"tableTo": "issues",
|
||||
"columnsFrom": ["issueId"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "no action",
|
||||
"onDelete": "no action"
|
||||
},
|
||||
"issueLabels_labelId_labels_id_fk": {
|
||||
"name": "issueLabels_labelId_labels_id_fk",
|
||||
"tableFrom": "issueLabels",
|
||||
"columnsFrom": [
|
||||
"labelId"
|
||||
],
|
||||
"tableTo": "labels",
|
||||
"columnsFrom": ["labelId"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "no action",
|
||||
"onDelete": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"isRLSEnabled": false,
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"issues": {
|
||||
"public.issues": {
|
||||
"name": "issues",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
|
|
@ -154,17 +169,24 @@
|
|||
"issues_authorId_users_id_fk": {
|
||||
"name": "issues_authorId_users_id_fk",
|
||||
"tableFrom": "issues",
|
||||
"columnsFrom": [
|
||||
"authorId"
|
||||
],
|
||||
"tableTo": "users",
|
||||
"columnsFrom": ["authorId"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "no action",
|
||||
"onDelete": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"isRLSEnabled": false,
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"labels": {
|
||||
"public.labels": {
|
||||
"name": "labels",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
|
|
@ -202,9 +224,12 @@
|
|||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"isRLSEnabled": false,
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"pullRequestLabels": {
|
||||
"public.pullRequestLabels": {
|
||||
"name": "pullRequestLabels",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
|
|
@ -226,26 +251,37 @@
|
|||
"pullRequestLabels_pullRequestExternalId_pullRequests_id_fk": {
|
||||
"name": "pullRequestLabels_pullRequestExternalId_pullRequests_id_fk",
|
||||
"tableFrom": "pullRequestLabels",
|
||||
"columnsFrom": [
|
||||
"pullRequestExternalId"
|
||||
],
|
||||
"tableTo": "pullRequests",
|
||||
"columnsFrom": ["pullRequestExternalId"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "no action",
|
||||
"onDelete": "no action"
|
||||
},
|
||||
"pullRequestLabels_labelId_labels_id_fk": {
|
||||
"name": "pullRequestLabels_labelId_labels_id_fk",
|
||||
"tableFrom": "pullRequestLabels",
|
||||
"columnsFrom": [
|
||||
"labelId"
|
||||
],
|
||||
"tableTo": "labels",
|
||||
"columnsFrom": ["labelId"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "no action",
|
||||
"onDelete": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"isRLSEnabled": false,
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"pullRequests": {
|
||||
"public.pullRequests": {
|
||||
"name": "pullRequests",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
|
|
@ -309,17 +345,24 @@
|
|||
"pullRequests_authorId_users_id_fk": {
|
||||
"name": "pullRequests_authorId_users_id_fk",
|
||||
"tableFrom": "pullRequests",
|
||||
"columnsFrom": [
|
||||
"authorId"
|
||||
],
|
||||
"tableTo": "users",
|
||||
"columnsFrom": ["authorId"],
|
||||
"columnsTo": ["id"],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "no action",
|
||||
"onDelete": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"isRLSEnabled": false,
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"users": {
|
||||
"public.users": {
|
||||
"name": "users",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
|
|
@ -351,14 +394,23 @@
|
|||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"isRLSEnabled": false,
|
||||
"checkConstraints": {}
|
||||
}
|
||||
},
|
||||
"enums": {},
|
||||
"schemas": {},
|
||||
"_meta": {
|
||||
"columns": {},
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
"tables": {},
|
||||
"columns": {}
|
||||
},
|
||||
"id": "b3a89784-eb82-49d8-b081-31c49e6906dc",
|
||||
"prevId": "a7895a79-44a3-4fad-b750-f89d8c04d85c",
|
||||
"sequences": {},
|
||||
"policies": {},
|
||||
"views": {},
|
||||
"roles": {}
|
||||
}
|
||||
Loading…
Reference in a new issue