migration: footer cert marks and social links
This commit is contained in:
parent
cab4779f7d
commit
b42d1729be
31335
src/migrations/20260220_122722.json
Normal file
31335
src/migrations/20260220_122722.json
Normal file
File diff suppressed because it is too large
Load Diff
46
src/migrations/20260220_122722.ts
Normal file
46
src/migrations/20260220_122722.ts
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||||
|
|
||||||
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
CREATE TABLE "footer_cert_marks" (
|
||||||
|
"_order" integer NOT NULL,
|
||||||
|
"_parent_id" integer NOT NULL,
|
||||||
|
"id" varchar PRIMARY KEY NOT NULL,
|
||||||
|
"image_id" integer NOT NULL,
|
||||||
|
"alt" varchar,
|
||||||
|
"link_url" varchar
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE "footer" ADD COLUMN "social_links_linkedin_enabled" boolean DEFAULT false;
|
||||||
|
ALTER TABLE "footer" ADD COLUMN "social_links_linkedin_url" varchar;
|
||||||
|
ALTER TABLE "footer" ADD COLUMN "social_links_instagram_enabled" boolean DEFAULT false;
|
||||||
|
ALTER TABLE "footer" ADD COLUMN "social_links_instagram_url" varchar;
|
||||||
|
ALTER TABLE "footer" ADD COLUMN "social_links_facebook_enabled" boolean DEFAULT false;
|
||||||
|
ALTER TABLE "footer" ADD COLUMN "social_links_facebook_url" varchar;
|
||||||
|
ALTER TABLE "footer" ADD COLUMN "social_links_youtube_enabled" boolean DEFAULT false;
|
||||||
|
ALTER TABLE "footer" ADD COLUMN "social_links_youtube_url" varchar;
|
||||||
|
ALTER TABLE "footer" ADD COLUMN "social_links_twitter_enabled" boolean DEFAULT false;
|
||||||
|
ALTER TABLE "footer" ADD COLUMN "social_links_twitter_url" varchar;
|
||||||
|
ALTER TABLE "footer_cert_marks" ADD CONSTRAINT "footer_cert_marks_image_id_media_id_fk" FOREIGN KEY ("image_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
ALTER TABLE "footer_cert_marks" ADD CONSTRAINT "footer_cert_marks_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."footer"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
CREATE INDEX "footer_cert_marks_order_idx" ON "footer_cert_marks" USING btree ("_order");
|
||||||
|
CREATE INDEX "footer_cert_marks_parent_id_idx" ON "footer_cert_marks" USING btree ("_parent_id");
|
||||||
|
CREATE INDEX "footer_cert_marks_image_idx" ON "footer_cert_marks" USING btree ("image_id");
|
||||||
|
ALTER TABLE "footer" DROP COLUMN "bottom_right_text";`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
DROP TABLE "footer_cert_marks" CASCADE;
|
||||||
|
ALTER TABLE "footer" ADD COLUMN "bottom_right_text" varchar DEFAULT 'Svenskt datacenter · ISO 27001 · ISO 14001';
|
||||||
|
ALTER TABLE "footer" DROP COLUMN "social_links_linkedin_enabled";
|
||||||
|
ALTER TABLE "footer" DROP COLUMN "social_links_linkedin_url";
|
||||||
|
ALTER TABLE "footer" DROP COLUMN "social_links_instagram_enabled";
|
||||||
|
ALTER TABLE "footer" DROP COLUMN "social_links_instagram_url";
|
||||||
|
ALTER TABLE "footer" DROP COLUMN "social_links_facebook_enabled";
|
||||||
|
ALTER TABLE "footer" DROP COLUMN "social_links_facebook_url";
|
||||||
|
ALTER TABLE "footer" DROP COLUMN "social_links_youtube_enabled";
|
||||||
|
ALTER TABLE "footer" DROP COLUMN "social_links_youtube_url";
|
||||||
|
ALTER TABLE "footer" DROP COLUMN "social_links_twitter_enabled";
|
||||||
|
ALTER TABLE "footer" DROP COLUMN "social_links_twitter_url";`)
|
||||||
|
}
|
||||||
@ -9,6 +9,7 @@ import * as migration_20260218_145924 from './20260218_145924';
|
|||||||
import * as migration_20260219_175400 from './20260219_175400';
|
import * as migration_20260219_175400 from './20260219_175400';
|
||||||
import * as migration_20260219_184333 from './20260219_184333';
|
import * as migration_20260219_184333 from './20260219_184333';
|
||||||
import * as migration_20260219_194949 from './20260219_194949';
|
import * as migration_20260219_194949 from './20260219_194949';
|
||||||
|
import * as migration_20260220_122722 from './20260220_122722';
|
||||||
|
|
||||||
export const migrations = [
|
export const migrations = [
|
||||||
{
|
{
|
||||||
@ -64,6 +65,11 @@ export const migrations = [
|
|||||||
{
|
{
|
||||||
up: migration_20260219_194949.up,
|
up: migration_20260219_194949.up,
|
||||||
down: migration_20260219_194949.down,
|
down: migration_20260219_194949.down,
|
||||||
name: '20260219_194949'
|
name: '20260219_194949',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
up: migration_20260220_122722.up,
|
||||||
|
down: migration_20260220_122722.down,
|
||||||
|
name: '20260220_122722'
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user