jamlen
06/06/2022, 11:52 AMError: invalid immediate value [object Object]
and it sounds like it has got two different versions of Kysely somehow. This is using Postgres on Aurora.jamlen
06/06/2022, 11:53 AMimport { sql, Kysely, Transaction } from "kysely";
export async function up(db) {
console.log(db.constructor === Kysely, db.constructor === Transaction);
// Migration code
await db.schema
.createTable("customer_profile")
.addColumn("id", "uuid", (col) =>
col.primaryKey().defaultTo(sql`gen_random_uuid()`)
)
.addColumn("first_name", "varchar", (col) => col.notNull())
.addColumn("last_name", "varchar", (col) => col.notNull())
.addColumn("account_id", "varchar(128)", (col) => col.notNull())
.addColumn("created_at", "TIMESTAMP", (col) =>
col.notNull().generatedAlwaysAs(sql`now()`)
)
.addColumn("modified_at", "TIMESTAMP")
.addColumn("version", "integer", (col) => col.notNull().defaultTo(1))
.execute();
}
export async function down(db) {
// Migration code
await db.schema.dropTable("customer_profile").execute();
}
jamlen
06/06/2022, 11:54 AMconsole.log
should report one of them as true
but I get both as false, false
which indicates the kysely I’m importing is not the same version of kysely as the migration gets invoked with.thdxr
06/06/2022, 12:04 PMjamlen
06/06/2022, 12:05 PMjamlen
06/06/2022, 12:05 PMthdxr
06/06/2022, 3:40 PMjamlen
06/06/2022, 4:02 PMthdxr
06/06/2022, 4:57 PMyarn sst update snapshot
thdxr
06/06/2022, 4:58 PMthdxr
06/06/2022, 4:58 PMjamlen
06/06/2022, 5:00 PM2022.06.04-14.36.23.365-Initial.mjs
the console only sees it as 2022
and then says file not found! I just renamed it so its fine, but a little gotchathdxr
06/06/2022, 5:01 PMthdxr
06/06/2022, 5:01 PMkysely-data-api
package to 0.0.11jamlen
06/06/2022, 5:04 PMtrue
in one of the consoles, but it errors with ERROR BadRequestException: ERROR: syntax error at or near "("
jamlen
06/06/2022, 5:04 PMjamlen
06/06/2022, 5:04 PMthdxr
06/06/2022, 5:05 PM.compile()
instead of .execute()
and loggingthdxr
06/06/2022, 5:05 PMjamlen
06/06/2022, 5:07 PMsql: 'create table "customer_profile" ("id" uuid default gen_random_uuid() primary key, "first_name" varchar not null, "last_name" varchar not null, "account_id" varchar(128) not null, "created_at" TIMESTAMP generated always as (now()) not null, "modified_at" TIMESTAMP, "version" integer default 1 not null)'
jamlen
06/06/2022, 5:08 PMcreated_at
column… and the generated always as
- I’ll remove that and see if it worksjamlen
06/06/2022, 5:11 PMjamlen
06/06/2022, 5:11 PMERROR BadRequestException: ERROR: function gen_random_uuid() does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.; SQLState: 42883
thdxr
06/06/2022, 5:18 PMjamlen
06/06/2022, 5:28 PMjamlen
06/07/2022, 10:19 AM