diff --git a/templates/with-postgres/src/migrations/20241210_000627_initial.json b/templates/with-postgres/src/migrations/20241211_181852_initial.json similarity index 99% rename from templates/with-postgres/src/migrations/20241210_000627_initial.json rename to templates/with-postgres/src/migrations/20241211_181852_initial.json index dc25dc3d895..9a0061c2a66 100644 --- a/templates/with-postgres/src/migrations/20241210_000627_initial.json +++ b/templates/with-postgres/src/migrations/20241211_181852_initial.json @@ -1,5 +1,5 @@ { - "id": "3a7129dd-a5a9-4fff-97c9-e02c3cf1e365", + "id": "f64eb78b-eee1-4f0a-b16e-0678c981d038", "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", diff --git a/templates/with-postgres/src/migrations/20241210_000627_initial.ts b/templates/with-postgres/src/migrations/20241211_181852_initial.ts similarity index 96% rename from templates/with-postgres/src/migrations/20241210_000627_initial.ts rename to templates/with-postgres/src/migrations/20241211_181852_initial.ts index 51aa575893a..7fbfc0a9c29 100644 --- a/templates/with-postgres/src/migrations/20241210_000627_initial.ts +++ b/templates/with-postgres/src/migrations/20241211_181852_initial.ts @@ -1,7 +1,7 @@ import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres' -export async function up({ payload, req }: MigrateUpArgs): Promise { - await payload.db.drizzle.execute(sql` +export async function up({ db, payload, req }: MigrateUpArgs): Promise { + await db.execute(sql` CREATE TABLE IF NOT EXISTS "users" ( "id" serial PRIMARY KEY NOT NULL, "updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL, @@ -126,8 +126,8 @@ export async function up({ payload, req }: MigrateUpArgs): Promise { CREATE INDEX IF NOT EXISTS "payload_migrations_created_at_idx" ON "payload_migrations" USING btree ("created_at");`) } -export async function down({ payload, req }: MigrateDownArgs): Promise { - await payload.db.drizzle.execute(sql` +export async function down({ db, payload, req }: MigrateDownArgs): Promise { + await db.execute(sql` DROP TABLE "users" CASCADE; DROP TABLE "media" CASCADE; DROP TABLE "payload_locked_documents" CASCADE; diff --git a/templates/with-postgres/src/migrations/index.ts b/templates/with-postgres/src/migrations/index.ts index 41a3e455668..20b55509737 100644 --- a/templates/with-postgres/src/migrations/index.ts +++ b/templates/with-postgres/src/migrations/index.ts @@ -1,9 +1,9 @@ -import * as migration_20241210_000627_initial from './20241210_000627_initial' +import * as migration_20241211_181852_initial from './20241211_181852_initial' export const migrations = [ { - up: migration_20241210_000627_initial.up, - down: migration_20241210_000627_initial.down, - name: '20241210_000627_initial', + up: migration_20241211_181852_initial.up, + down: migration_20241211_181852_initial.down, + name: '20241211_181852_initial', }, ] diff --git a/templates/with-vercel-postgres/src/migrations/20241210_000603_initial.json b/templates/with-vercel-postgres/src/migrations/20241211_181826_initial.json similarity index 99% rename from templates/with-vercel-postgres/src/migrations/20241210_000603_initial.json rename to templates/with-vercel-postgres/src/migrations/20241211_181826_initial.json index 1a31b05a38f..7ee0d701607 100644 --- a/templates/with-vercel-postgres/src/migrations/20241210_000603_initial.json +++ b/templates/with-vercel-postgres/src/migrations/20241211_181826_initial.json @@ -1,5 +1,5 @@ { - "id": "559763df-0cb1-4831-b61e-7176a2b4f9d5", + "id": "caa6bd33-8ffb-423d-a29d-c6f36780fb0c", "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", diff --git a/templates/with-vercel-postgres/src/migrations/20241210_000603_initial.ts b/templates/with-vercel-postgres/src/migrations/20241211_181826_initial.ts similarity index 96% rename from templates/with-vercel-postgres/src/migrations/20241210_000603_initial.ts rename to templates/with-vercel-postgres/src/migrations/20241211_181826_initial.ts index 226209fe7ff..f776e9ec382 100644 --- a/templates/with-vercel-postgres/src/migrations/20241210_000603_initial.ts +++ b/templates/with-vercel-postgres/src/migrations/20241211_181826_initial.ts @@ -1,7 +1,7 @@ import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-vercel-postgres' -export async function up({ payload, req }: MigrateUpArgs): Promise { - await payload.db.drizzle.execute(sql` +export async function up({ db, payload, req }: MigrateUpArgs): Promise { + await db.execute(sql` CREATE TABLE IF NOT EXISTS "users" ( "id" serial PRIMARY KEY NOT NULL, "updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL, @@ -126,8 +126,8 @@ export async function up({ payload, req }: MigrateUpArgs): Promise { CREATE INDEX IF NOT EXISTS "payload_migrations_created_at_idx" ON "payload_migrations" USING btree ("created_at");`) } -export async function down({ payload, req }: MigrateDownArgs): Promise { - await payload.db.drizzle.execute(sql` +export async function down({ db, payload, req }: MigrateDownArgs): Promise { + await db.execute(sql` DROP TABLE "users" CASCADE; DROP TABLE "media" CASCADE; DROP TABLE "payload_locked_documents" CASCADE; diff --git a/templates/with-vercel-postgres/src/migrations/index.ts b/templates/with-vercel-postgres/src/migrations/index.ts index 1f9ba26d955..4f03c721c36 100644 --- a/templates/with-vercel-postgres/src/migrations/index.ts +++ b/templates/with-vercel-postgres/src/migrations/index.ts @@ -1,9 +1,9 @@ -import * as migration_20241210_000603_initial from './20241210_000603_initial' +import * as migration_20241211_181826_initial from './20241211_181826_initial' export const migrations = [ { - up: migration_20241210_000603_initial.up, - down: migration_20241210_000603_initial.down, - name: '20241210_000603_initial', + up: migration_20241211_181826_initial.up, + down: migration_20241211_181826_initial.down, + name: '20241211_181826_initial', }, ] diff --git a/templates/with-vercel-website/src/migrations/20241210_000617_initial.json b/templates/with-vercel-website/src/migrations/20241211_181841_initial.json similarity index 99% rename from templates/with-vercel-website/src/migrations/20241210_000617_initial.json rename to templates/with-vercel-website/src/migrations/20241211_181841_initial.json index 0cad90a93a0..f676e9b1621 100644 --- a/templates/with-vercel-website/src/migrations/20241210_000617_initial.json +++ b/templates/with-vercel-website/src/migrations/20241211_181841_initial.json @@ -1,5 +1,5 @@ { - "id": "37ea3c82-a0e9-4bfa-9693-f24bdd61e87c", + "id": "fc9ae914-9413-4fca-a0a1-48eddce34984", "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", diff --git a/templates/with-vercel-website/src/migrations/20241210_000617_initial.ts b/templates/with-vercel-website/src/migrations/20241211_181841_initial.ts similarity index 99% rename from templates/with-vercel-website/src/migrations/20241210_000617_initial.ts rename to templates/with-vercel-website/src/migrations/20241211_181841_initial.ts index c7f7dcb8649..781ba313119 100644 --- a/templates/with-vercel-website/src/migrations/20241210_000617_initial.ts +++ b/templates/with-vercel-website/src/migrations/20241211_181841_initial.ts @@ -1,7 +1,7 @@ import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-vercel-postgres' -export async function up({ payload, req }: MigrateUpArgs): Promise { - await payload.db.drizzle.execute(sql` +export async function up({ db, payload, req }: MigrateUpArgs): Promise { + await db.execute(sql` CREATE TYPE "public"."enum_pages_hero_type" AS ENUM('none', 'highImpact', 'mediumImpact', 'lowImpact'); CREATE TYPE "public"."enum_pages_hero_links_link_type" AS ENUM('reference', 'custom'); CREATE TYPE "public"."enum_pages_hero_links_link_appearance" AS ENUM('default', 'outline'); @@ -1466,8 +1466,8 @@ export async function up({ payload, req }: MigrateUpArgs): Promise { CREATE INDEX IF NOT EXISTS "footer_rels_pages_id_idx" ON "footer_rels" USING btree ("pages_id");`) } -export async function down({ payload, req }: MigrateDownArgs): Promise { - await payload.db.drizzle.execute(sql` +export async function down({ db, payload, req }: MigrateDownArgs): Promise { + await db.execute(sql` DROP TABLE "pages_hero_links" CASCADE; DROP TABLE "pages_blocks_cta_links" CASCADE; DROP TABLE "pages_blocks_cta" CASCADE; diff --git a/templates/with-vercel-website/src/migrations/index.ts b/templates/with-vercel-website/src/migrations/index.ts index fdfdc08eec0..3be9fe782e4 100644 --- a/templates/with-vercel-website/src/migrations/index.ts +++ b/templates/with-vercel-website/src/migrations/index.ts @@ -1,9 +1,9 @@ -import * as migration_20241210_000617_initial from './20241210_000617_initial' +import * as migration_20241211_181841_initial from './20241211_181841_initial' export const migrations = [ { - up: migration_20241210_000617_initial.up, - down: migration_20241210_000617_initial.down, - name: '20241210_000617_initial', + up: migration_20241211_181841_initial.up, + down: migration_20241211_181841_initial.down, + name: '20241211_181841_initial', }, ]