Skip to content

Commit 44b6c8a

Browse files
committed
Fix tests for libsql and sqlite
1 parent cadba24 commit 44b6c8a

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

integration-tests/tests/sqlite/sqlite-common.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ export function tests() {
153153
await db.run(sql`drop table if exists ${orders}`);
154154
await db.run(sql`drop table if exists ${bigIntExample}`);
155155
await db.run(sql`drop table if exists ${pkExampleTable}`);
156+
await db.run(sql`drop table if exists user_notifications_insert_into`);
157+
await db.run(sql`drop table if exists users_insert_into`);
158+
await db.run(sql`drop table if exists notifications_insert_into`);
156159

157160
await db.run(sql`
158161
create table ${usersTable} (
@@ -3247,42 +3250,42 @@ export function tests() {
32473250
test('insert into ... select', async (ctx) => {
32483251
const { db } = ctx.sqlite;
32493252

3250-
const notifications = sqliteTable('notifications', {
3253+
const notifications = sqliteTable('notifications_insert_into', {
32513254
id: integer('id').primaryKey({ autoIncrement: true }),
32523255
sentAt: integer('sent_at', { mode: 'timestamp' }).notNull().default(sql`current_timestamp`),
32533256
message: text('message').notNull(),
32543257
});
3255-
const users = sqliteTable('users', {
3258+
const users = sqliteTable('users_insert_into', {
32563259
id: integer('id').primaryKey({ autoIncrement: true }),
32573260
name: text('name').notNull(),
32583261
});
3259-
const userNotications = sqliteTable('user_notifications', {
3262+
const userNotications = sqliteTable('user_notifications_insert_into', {
32603263
userId: integer('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }),
32613264
notificationId: integer('notification_id').notNull().references(() => notifications.id, { onDelete: 'cascade' }),
32623265
}, (t) => ({
32633266
pk: primaryKey({ columns: [t.userId, t.notificationId] }),
32643267
}));
32653268

3266-
await db.run(sql`drop table if exists notifications`);
3267-
await db.run(sql`drop table if exists users`);
3268-
await db.run(sql`drop table if exists user_notifications`);
3269+
await db.run(sql`drop table if exists notifications_insert_into`);
3270+
await db.run(sql`drop table if exists users_insert_into`);
3271+
await db.run(sql`drop table if exists user_notifications_insert_into`);
32693272
await db.run(sql`
3270-
create table notifications (
3273+
create table notifications_insert_into (
32713274
id integer primary key autoincrement,
32723275
sent_at integer not null default (current_timestamp),
32733276
message text not null
32743277
)
32753278
`);
32763279
await db.run(sql`
3277-
create table users (
3280+
create table users_insert_into (
32783281
id integer primary key autoincrement,
32793282
name text not null
32803283
)
32813284
`);
32823285
await db.run(sql`
3283-
create table user_notifications (
3284-
user_id integer references users(id) on delete cascade,
3285-
notification_id integer references notifications(id) on delete cascade,
3286+
create table user_notifications_insert_into (
3287+
user_id integer references users_insert_into(id) on delete cascade,
3288+
notification_id integer references notifications_insert_into(id) on delete cascade,
32863289
primary key (user_id, notification_id)
32873290
)
32883291
`);

0 commit comments

Comments
 (0)