fix(migrations): update init migration schema to match current blocks and navigation
This commit is contained in:
@@ -189,13 +189,16 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
|||||||
\`_parent_id\` integer NOT NULL,
|
\`_parent_id\` integer NOT NULL,
|
||||||
\`_path\` text NOT NULL,
|
\`_path\` text NOT NULL,
|
||||||
\`id\` text PRIMARY KEY NOT NULL,
|
\`id\` text PRIMARY KEY NOT NULL,
|
||||||
|
\`background_image_id\` integer,
|
||||||
\`block_name\` text,
|
\`block_name\` text,
|
||||||
|
FOREIGN KEY (\`background_image_id\`) REFERENCES \`media\`(\`id\`) ON UPDATE no action ON DELETE set null,
|
||||||
FOREIGN KEY (\`_parent_id\`) REFERENCES \`pages\`(\`id\`) ON UPDATE no action ON DELETE cascade
|
FOREIGN KEY (\`_parent_id\`) REFERENCES \`pages\`(\`id\`) ON UPDATE no action ON DELETE cascade
|
||||||
);
|
);
|
||||||
`)
|
`)
|
||||||
await db.run(sql`CREATE INDEX \`pages_blocks_process_steps_order_idx\` ON \`pages_blocks_process_steps\` (\`_order\`);`)
|
await db.run(sql`CREATE INDEX \`pages_blocks_process_steps_order_idx\` ON \`pages_blocks_process_steps\` (\`_order\`);`)
|
||||||
await db.run(sql`CREATE INDEX \`pages_blocks_process_steps_parent_id_idx\` ON \`pages_blocks_process_steps\` (\`_parent_id\`);`)
|
await db.run(sql`CREATE INDEX \`pages_blocks_process_steps_parent_id_idx\` ON \`pages_blocks_process_steps\` (\`_parent_id\`);`)
|
||||||
await db.run(sql`CREATE INDEX \`pages_blocks_process_steps_path_idx\` ON \`pages_blocks_process_steps\` (\`_path\`);`)
|
await db.run(sql`CREATE INDEX \`pages_blocks_process_steps_path_idx\` ON \`pages_blocks_process_steps\` (\`_path\`);`)
|
||||||
|
await db.run(sql`CREATE INDEX \`pages_blocks_process_steps_background_image_idx\` ON \`pages_blocks_process_steps\` (\`background_image_id\`);`)
|
||||||
await db.run(sql`CREATE TABLE \`pages_blocks_process_steps_locales\` (
|
await db.run(sql`CREATE TABLE \`pages_blocks_process_steps_locales\` (
|
||||||
\`badge\` text,
|
\`badge\` text,
|
||||||
\`heading\` text NOT NULL,
|
\`heading\` text NOT NULL,
|
||||||
@@ -324,13 +327,16 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
|||||||
\`_parent_id\` integer NOT NULL,
|
\`_parent_id\` integer NOT NULL,
|
||||||
\`_path\` text NOT NULL,
|
\`_path\` text NOT NULL,
|
||||||
\`id\` text PRIMARY KEY NOT NULL,
|
\`id\` text PRIMARY KEY NOT NULL,
|
||||||
|
\`background_image_id\` integer,
|
||||||
\`block_name\` text,
|
\`block_name\` text,
|
||||||
|
FOREIGN KEY (\`background_image_id\`) REFERENCES \`media\`(\`id\`) ON UPDATE no action ON DELETE set null,
|
||||||
FOREIGN KEY (\`_parent_id\`) REFERENCES \`pages\`(\`id\`) ON UPDATE no action ON DELETE cascade
|
FOREIGN KEY (\`_parent_id\`) REFERENCES \`pages\`(\`id\`) ON UPDATE no action ON DELETE cascade
|
||||||
);
|
);
|
||||||
`)
|
`)
|
||||||
await db.run(sql`CREATE INDEX \`pages_blocks_tech_equipment_order_idx\` ON \`pages_blocks_tech_equipment\` (\`_order\`);`)
|
await db.run(sql`CREATE INDEX \`pages_blocks_tech_equipment_order_idx\` ON \`pages_blocks_tech_equipment\` (\`_order\`);`)
|
||||||
await db.run(sql`CREATE INDEX \`pages_blocks_tech_equipment_parent_id_idx\` ON \`pages_blocks_tech_equipment\` (\`_parent_id\`);`)
|
await db.run(sql`CREATE INDEX \`pages_blocks_tech_equipment_parent_id_idx\` ON \`pages_blocks_tech_equipment\` (\`_parent_id\`);`)
|
||||||
await db.run(sql`CREATE INDEX \`pages_blocks_tech_equipment_path_idx\` ON \`pages_blocks_tech_equipment\` (\`_path\`);`)
|
await db.run(sql`CREATE INDEX \`pages_blocks_tech_equipment_path_idx\` ON \`pages_blocks_tech_equipment\` (\`_path\`);`)
|
||||||
|
await db.run(sql`CREATE INDEX \`pages_blocks_tech_equipment_background_image_idx\` ON \`pages_blocks_tech_equipment\` (\`background_image_id\`);`)
|
||||||
await db.run(sql`CREATE TABLE \`pages_blocks_tech_equipment_locales\` (
|
await db.run(sql`CREATE TABLE \`pages_blocks_tech_equipment_locales\` (
|
||||||
\`badge\` text,
|
\`badge\` text,
|
||||||
\`heading\` text NOT NULL,
|
\`heading\` text NOT NULL,
|
||||||
@@ -421,32 +427,28 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
|||||||
\`_parent_id\` integer NOT NULL,
|
\`_parent_id\` integer NOT NULL,
|
||||||
\`_path\` text NOT NULL,
|
\`_path\` text NOT NULL,
|
||||||
\`id\` text PRIMARY KEY NOT NULL,
|
\`id\` text PRIMARY KEY NOT NULL,
|
||||||
|
\`form_id\` integer NOT NULL,
|
||||||
|
\`phone\` text,
|
||||||
|
\`email\` text,
|
||||||
|
\`address\` text,
|
||||||
\`block_name\` text,
|
\`block_name\` text,
|
||||||
|
FOREIGN KEY (\`form_id\`) REFERENCES \`forms\`(\`id\`) ON UPDATE no action ON DELETE cascade,
|
||||||
FOREIGN KEY (\`_parent_id\`) REFERENCES \`pages\`(\`id\`) ON UPDATE no action ON DELETE cascade
|
FOREIGN KEY (\`_parent_id\`) REFERENCES \`pages\`(\`id\`) ON UPDATE no action ON DELETE cascade
|
||||||
);
|
);
|
||||||
`)
|
`)
|
||||||
await db.run(sql`CREATE INDEX \`pages_blocks_form_block_order_idx\` ON \`pages_blocks_form_block\` (\`_order\`);`)
|
await db.run(sql`CREATE INDEX \`pages_blocks_form_block_order_idx\` ON \`pages_blocks_form_block\` (\`_order\`);`)
|
||||||
await db.run(sql`CREATE INDEX \`pages_blocks_form_block_parent_id_idx\` ON \`pages_blocks_form_block\` (\`_parent_id\`);`)
|
await db.run(sql`CREATE INDEX \`pages_blocks_form_block_parent_id_idx\` ON \`pages_blocks_form_block\` (\`_parent_id\`);`)
|
||||||
await db.run(sql`CREATE INDEX \`pages_blocks_form_block_path_idx\` ON \`pages_blocks_form_block\` (\`_path\`);`)
|
await db.run(sql`CREATE INDEX \`pages_blocks_form_block_path_idx\` ON \`pages_blocks_form_block\` (\`_path\`);`)
|
||||||
|
await db.run(sql`CREATE INDEX \`pages_blocks_form_block_form_idx\` ON \`pages_blocks_form_block\` (\`form_id\`);`)
|
||||||
await db.run(sql`CREATE TABLE \`pages_blocks_form_block_locales\` (
|
await db.run(sql`CREATE TABLE \`pages_blocks_form_block_locales\` (
|
||||||
\`badge\` text,
|
\`badge\` text,
|
||||||
\`heading\` text NOT NULL,
|
\`heading\` text NOT NULL,
|
||||||
\`subheading\` text,
|
\`subheading\` text,
|
||||||
\`phone\` text,
|
|
||||||
\`direct_phone_label\` text DEFAULT 'Telefon bezpośredni',
|
\`direct_phone_label\` text DEFAULT 'Telefon bezpośredni',
|
||||||
\`email\` text,
|
|
||||||
\`email_contact_label\` text DEFAULT 'Kontakt e-mail',
|
\`email_contact_label\` text DEFAULT 'Kontakt e-mail',
|
||||||
\`working_hours\` text,
|
\`working_hours\` text,
|
||||||
\`working_hours_label\` text DEFAULT 'Godziny pracy',
|
\`working_hours_label\` text DEFAULT 'Godziny pracy',
|
||||||
\`name_label\` text DEFAULT 'Imię i Nazwisko *',
|
\`address_label\` text DEFAULT 'Adres biura',
|
||||||
\`phone_input_label\` text DEFAULT 'Numer Telefonu *',
|
|
||||||
\`location_label\` text DEFAULT 'Miejscowość',
|
|
||||||
\`area_label\` text DEFAULT 'Szacowany Metraż (m²)',
|
|
||||||
\`message_label\` text DEFAULT 'Zakres prac / stan nawierzchni',
|
|
||||||
\`submit_button_text\` text DEFAULT 'Wyślij zapytanie o bezpłatną wycenę',
|
|
||||||
\`consent_text\` text DEFAULT 'Wyrażam zgodę na przetwarzanie moich danych osobowych w celu kontaktu i przygotowania oferty zgodnie z Polityką Prywatności.',
|
|
||||||
\`success_heading\` text DEFAULT 'Zgłoszenie zostało wysłane',
|
|
||||||
\`success_message\` text DEFAULT 'Nasz doradca techniczny skontaktuje się z Państwem telefonicznie w celu przygotowania dokładnej wyceny.',
|
|
||||||
\`id\` integer PRIMARY KEY NOT NULL,
|
\`id\` integer PRIMARY KEY NOT NULL,
|
||||||
\`_locale\` text NOT NULL,
|
\`_locale\` text NOT NULL,
|
||||||
\`_parent_id\` text NOT NULL,
|
\`_parent_id\` text NOT NULL,
|
||||||
@@ -968,9 +970,7 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
|||||||
await db.run(sql`CREATE TABLE \`navigation_header_items\` (
|
await db.run(sql`CREATE TABLE \`navigation_header_items\` (
|
||||||
\`_order\` integer NOT NULL,
|
\`_order\` integer NOT NULL,
|
||||||
\`_parent_id\` integer NOT NULL,
|
\`_parent_id\` integer NOT NULL,
|
||||||
\`_locale\` text NOT NULL,
|
|
||||||
\`id\` text PRIMARY KEY NOT NULL,
|
\`id\` text PRIMARY KEY NOT NULL,
|
||||||
\`label\` text NOT NULL,
|
|
||||||
\`page_id\` integer,
|
\`page_id\` integer,
|
||||||
\`url\` text,
|
\`url\` text,
|
||||||
FOREIGN KEY (\`page_id\`) REFERENCES \`pages\`(\`id\`) ON UPDATE no action ON DELETE set null,
|
FOREIGN KEY (\`page_id\`) REFERENCES \`pages\`(\`id\`) ON UPDATE no action ON DELETE set null,
|
||||||
@@ -979,14 +979,20 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
|||||||
`)
|
`)
|
||||||
await db.run(sql`CREATE INDEX \`navigation_header_items_order_idx\` ON \`navigation_header_items\` (\`_order\`);`)
|
await db.run(sql`CREATE INDEX \`navigation_header_items_order_idx\` ON \`navigation_header_items\` (\`_order\`);`)
|
||||||
await db.run(sql`CREATE INDEX \`navigation_header_items_parent_id_idx\` ON \`navigation_header_items\` (\`_parent_id\`);`)
|
await db.run(sql`CREATE INDEX \`navigation_header_items_parent_id_idx\` ON \`navigation_header_items\` (\`_parent_id\`);`)
|
||||||
await db.run(sql`CREATE INDEX \`navigation_header_items_locale_idx\` ON \`navigation_header_items\` (\`_locale\`);`)
|
|
||||||
await db.run(sql`CREATE INDEX \`navigation_header_items_page_idx\` ON \`navigation_header_items\` (\`page_id\`);`)
|
await db.run(sql`CREATE INDEX \`navigation_header_items_page_idx\` ON \`navigation_header_items\` (\`page_id\`);`)
|
||||||
|
await db.run(sql`CREATE TABLE \`navigation_header_items_locales\` (
|
||||||
|
\`label\` text NOT NULL,
|
||||||
|
\`id\` integer PRIMARY KEY NOT NULL,
|
||||||
|
\`_locale\` text NOT NULL,
|
||||||
|
\`_parent_id\` text NOT NULL,
|
||||||
|
FOREIGN KEY (\`_parent_id\`) REFERENCES \`navigation_header_items\`(\`id\`) ON UPDATE no action ON DELETE cascade
|
||||||
|
);
|
||||||
|
`)
|
||||||
|
await db.run(sql`CREATE UNIQUE INDEX \`navigation_header_items_locales_locale_parent_id_unique\` ON \`navigation_header_items_locales\` (\`_locale\`,\`_parent_id\`);`)
|
||||||
await db.run(sql`CREATE TABLE \`navigation_footer_items\` (
|
await db.run(sql`CREATE TABLE \`navigation_footer_items\` (
|
||||||
\`_order\` integer NOT NULL,
|
\`_order\` integer NOT NULL,
|
||||||
\`_parent_id\` integer NOT NULL,
|
\`_parent_id\` integer NOT NULL,
|
||||||
\`_locale\` text NOT NULL,
|
|
||||||
\`id\` text PRIMARY KEY NOT NULL,
|
\`id\` text PRIMARY KEY NOT NULL,
|
||||||
\`label\` text NOT NULL,
|
|
||||||
\`page_id\` integer,
|
\`page_id\` integer,
|
||||||
\`url\` text,
|
\`url\` text,
|
||||||
FOREIGN KEY (\`page_id\`) REFERENCES \`pages\`(\`id\`) ON UPDATE no action ON DELETE set null,
|
FOREIGN KEY (\`page_id\`) REFERENCES \`pages\`(\`id\`) ON UPDATE no action ON DELETE set null,
|
||||||
@@ -995,31 +1001,40 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
|||||||
`)
|
`)
|
||||||
await db.run(sql`CREATE INDEX \`navigation_footer_items_order_idx\` ON \`navigation_footer_items\` (\`_order\`);`)
|
await db.run(sql`CREATE INDEX \`navigation_footer_items_order_idx\` ON \`navigation_footer_items\` (\`_order\`);`)
|
||||||
await db.run(sql`CREATE INDEX \`navigation_footer_items_parent_id_idx\` ON \`navigation_footer_items\` (\`_parent_id\`);`)
|
await db.run(sql`CREATE INDEX \`navigation_footer_items_parent_id_idx\` ON \`navigation_footer_items\` (\`_parent_id\`);`)
|
||||||
await db.run(sql`CREATE INDEX \`navigation_footer_items_locale_idx\` ON \`navigation_footer_items\` (\`_locale\`);`)
|
|
||||||
await db.run(sql`CREATE INDEX \`navigation_footer_items_page_idx\` ON \`navigation_footer_items\` (\`page_id\`);`)
|
await db.run(sql`CREATE INDEX \`navigation_footer_items_page_idx\` ON \`navigation_footer_items\` (\`page_id\`);`)
|
||||||
await db.run(sql`CREATE TABLE \`navigation\` (
|
await db.run(sql`CREATE TABLE \`navigation_footer_items_locales\` (
|
||||||
|
\`label\` text NOT NULL,
|
||||||
\`id\` integer PRIMARY KEY NOT NULL,
|
\`id\` integer PRIMARY KEY NOT NULL,
|
||||||
\`updated_at\` text,
|
\`_locale\` text NOT NULL,
|
||||||
\`created_at\` text
|
\`_parent_id\` text NOT NULL,
|
||||||
|
FOREIGN KEY (\`_parent_id\`) REFERENCES \`navigation_footer_items\`(\`id\`) ON UPDATE no action ON DELETE cascade
|
||||||
);
|
);
|
||||||
`)
|
`)
|
||||||
|
await db.run(sql`CREATE UNIQUE INDEX \`navigation_footer_items_locales_locale_parent_id_unique\` ON \`navigation_footer_items_locales\` (\`_locale\`,\`_parent_id\`);`)
|
||||||
|
await db.run(sql`CREATE TABLE \`navigation\` (
|
||||||
|
\`id\` integer PRIMARY KEY NOT NULL,
|
||||||
|
\`cta_button_page_id\` integer,
|
||||||
|
\`cta_button_url\` text DEFAULT '#formularz-kontaktowy',
|
||||||
|
\`updated_at\` text,
|
||||||
|
\`created_at\` text,
|
||||||
|
FOREIGN KEY (\`cta_button_page_id\`) REFERENCES \`pages\`(\`id\`) ON UPDATE no action ON DELETE set null
|
||||||
|
);
|
||||||
|
`)
|
||||||
|
await db.run(sql`CREATE INDEX \`navigation_cta_button_page_idx\` ON \`navigation\` (\`cta_button_page_id\`);`)
|
||||||
await db.run(sql`CREATE TABLE \`navigation_locales\` (
|
await db.run(sql`CREATE TABLE \`navigation_locales\` (
|
||||||
\`tagline\` text DEFAULT 'Profesjonalne Mycie i Renowacja Nawierzchni Brukowych',
|
\`tagline\` text DEFAULT 'Profesjonalne Mycie i Renowacja Nawierzchni Brukowych',
|
||||||
\`phone_label\` text DEFAULT 'Infolinia / Bezpłatna wycena:',
|
\`phone_label\` text DEFAULT 'Infolinia / Bezpłatna wycena:',
|
||||||
\`cta_button_label\` text DEFAULT 'KONTAKT',
|
\`cta_button_label\` text DEFAULT 'KONTAKT',
|
||||||
\`cta_button_page_id\` integer,
|
|
||||||
\`cta_button_url\` text DEFAULT '#formularz-kontaktowy',
|
|
||||||
\`footer_tagline\` text DEFAULT 'Wyspecjalizowane usługi mycia gorącowodnego, usuwania mchu, odplamiania oleju, spoinowania i impregnacji hydrofobowej nawierzchni brukowych.',
|
\`footer_tagline\` text DEFAULT 'Wyspecjalizowane usługi mycia gorącowodnego, usuwania mchu, odplamiania oleju, spoinowania i impregnacji hydrofobowej nawierzchni brukowych.',
|
||||||
\`nav_title\` text DEFAULT 'Nawigacja',
|
\`nav_title\` text DEFAULT 'Nawigacja',
|
||||||
\`contact_title\` text DEFAULT 'Kontakt',
|
\`contact_title\` text DEFAULT 'Kontakt',
|
||||||
|
\`legal_title\` text DEFAULT 'Polityki i regulamin',
|
||||||
\`id\` integer PRIMARY KEY NOT NULL,
|
\`id\` integer PRIMARY KEY NOT NULL,
|
||||||
\`_locale\` text NOT NULL,
|
\`_locale\` text NOT NULL,
|
||||||
\`_parent_id\` integer NOT NULL,
|
\`_parent_id\` integer NOT NULL,
|
||||||
FOREIGN KEY (\`cta_button_page_id\`) REFERENCES \`pages\`(\`id\`) ON UPDATE no action ON DELETE set null,
|
|
||||||
FOREIGN KEY (\`_parent_id\`) REFERENCES \`navigation\`(\`id\`) ON UPDATE no action ON DELETE cascade
|
FOREIGN KEY (\`_parent_id\`) REFERENCES \`navigation\`(\`id\`) ON UPDATE no action ON DELETE cascade
|
||||||
);
|
);
|
||||||
`)
|
`)
|
||||||
await db.run(sql`CREATE INDEX \`navigation_cta_button_cta_button_page_idx\` ON \`navigation_locales\` (\`cta_button_page_id\`);`)
|
|
||||||
await db.run(sql`CREATE UNIQUE INDEX \`navigation_locales_locale_parent_id_unique\` ON \`navigation_locales\` (\`_locale\`,\`_parent_id\`);`)
|
await db.run(sql`CREATE UNIQUE INDEX \`navigation_locales_locale_parent_id_unique\` ON \`navigation_locales\` (\`_locale\`,\`_parent_id\`);`)
|
||||||
await db.run(sql`CREATE TABLE \`site_settings\` (
|
await db.run(sql`CREATE TABLE \`site_settings\` (
|
||||||
\`id\` integer PRIMARY KEY NOT NULL,
|
\`id\` integer PRIMARY KEY NOT NULL,
|
||||||
@@ -1222,7 +1237,9 @@ export async function down({ db, payload, req }: MigrateDownArgs): Promise<void>
|
|||||||
await db.run(sql`DROP TABLE \`company\`;`)
|
await db.run(sql`DROP TABLE \`company\`;`)
|
||||||
await db.run(sql`DROP TABLE \`company_locales\`;`)
|
await db.run(sql`DROP TABLE \`company_locales\`;`)
|
||||||
await db.run(sql`DROP TABLE \`navigation_header_items\`;`)
|
await db.run(sql`DROP TABLE \`navigation_header_items\`;`)
|
||||||
|
await db.run(sql`DROP TABLE \`navigation_header_items_locales\`;`)
|
||||||
await db.run(sql`DROP TABLE \`navigation_footer_items\`;`)
|
await db.run(sql`DROP TABLE \`navigation_footer_items\`;`)
|
||||||
|
await db.run(sql`DROP TABLE \`navigation_footer_items_locales\`;`)
|
||||||
await db.run(sql`DROP TABLE \`navigation\`;`)
|
await db.run(sql`DROP TABLE \`navigation\`;`)
|
||||||
await db.run(sql`DROP TABLE \`navigation_locales\`;`)
|
await db.run(sql`DROP TABLE \`navigation_locales\`;`)
|
||||||
await db.run(sql`DROP TABLE \`site_settings\`;`)
|
await db.run(sql`DROP TABLE \`site_settings\`;`)
|
||||||
|
|||||||
Reference in New Issue
Block a user