diff --git a/drizzle.config.ts b/drizzle.config.ts index ab195bb..b97a4e9 100644 --- a/drizzle.config.ts +++ b/drizzle.config.ts @@ -7,7 +7,7 @@ export default defineConfig({ dbCredentials: { user: process.env.DB_USERNAME || 'root', password: process.env.DB_PASSWORD || '', - host: process.env.DB_HOST || 'localhost', + host: process.env.DB_HOST || '127.0.0.1' || 'localhost', port: parseInt(process.env.DB_PORT || '3306'), database: process.env.DB_NAME || 'oneform_db', }, diff --git a/src/db/schema.mysql.ts b/src/db/schema.mysql.ts index b48a5b4..48b1d0c 100644 --- a/src/db/schema.mysql.ts +++ b/src/db/schema.mysql.ts @@ -16,7 +16,7 @@ export const UserAuth = mysqlTable("user_auth", { id: varchar("id", { length: 26 }).primaryKey(), userId: varchar("user_id", { length: 26 }).references(() => User.id).notNull(), type: varchar("type", { length: 255 }).notNull(), - identifier: varchar("identifier", { length: 1024 }).notNull(), + identifier: varchar("identifier", { length: 256 }).notNull(), }, (table) => { return { @@ -48,7 +48,7 @@ export const Form = mysqlTable("form", { export const View = mysqlTable("view", { id: varchar("id", { length: 26 }).primaryKey(), teamId: varchar("team_id", { length: 26 }).references(() => Team.id).notNull(), - route: varchar("route", { length: 1024 }).notNull().unique(), + route: varchar("route", { length: 256 }).notNull().unique(), title: text("title").notNull(), schema: json("schema"), config: json("config"), @@ -60,7 +60,7 @@ export const View = mysqlTable("view", { export const ViewComponent = mysqlTable("view_component", { id: varchar("id", { length: 26 }).primaryKey(), teamId: varchar("team_id", { length: 26 }).references(() => Team.id).notNull(), - identifier: varchar("identifier", { length: 1024 }).notNull().unique(), + identifier: varchar("identifier", { length: 256 }).notNull().unique(), title: text("title").notNull(), schema: text("schema"), config: text("config"), diff --git a/src/lib/db.ts b/src/lib/db.ts index 19b915c..cfd4d70 100644 --- a/src/lib/db.ts +++ b/src/lib/db.ts @@ -4,11 +4,11 @@ import {migrate} from 'drizzle-orm/mysql2/migrator'; import * as schema from '@/db/schema'; import mysql from 'mysql2/promise'; const mySqlConfig = { - host: import.meta.env.DB_HOST || 'localhost', - user: import.meta.env.DB_USERNAME || 'root', - password: import.meta.env.DB_PASSWORD || '', - database: import.meta.env.DB_NAME || 'oneform_db', - port: parseInt(import.meta.env.DB_PORT || '3306'), + host: process.env.DB_HOST || '127.0.0.1' || 'localhost', + user: process.env.DB_USER || 'root', + password: process.env.DB_PASSWORD || '', + database: process.env.DB_NAME || 'oneform_db', + port: parseInt(process.env.DB_PORT || '3306'), }; const sql = mysql.createPool(mySqlConfig);