31 lines
991 B
JavaScript
31 lines
991 B
JavaScript
/**
|
|
* Migration 022: Store settings key-value table.
|
|
* Stores dynamic store configuration editable from admin panel.
|
|
*/
|
|
exports.up = async (pgm) => {
|
|
await pgm.sql(`
|
|
CREATE TABLE IF NOT EXISTS store_settings (
|
|
key VARCHAR(64) PRIMARY KEY,
|
|
value TEXT NOT NULL DEFAULT '',
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_by UUID REFERENCES identity_users(id) ON DELETE SET NULL
|
|
);
|
|
|
|
-- Seed default settings
|
|
INSERT INTO store_settings (key, value) VALUES
|
|
('store_name', 'Mercado de Vida'),
|
|
('store_tagline', 'Productos naturales y ecológicos'),
|
|
('contact_email', 'info@mercadodevida.es'),
|
|
('contact_phone', ''),
|
|
('contact_address', ''),
|
|
('footer_text', '© 2026 Mercado de Vida. Todos los derechos reservados.'),
|
|
('facebook_url', ''),
|
|
('instagram_url', '')
|
|
ON CONFLICT (key) DO NOTHING;
|
|
`);
|
|
};
|
|
|
|
exports.down = async (pgm) => {
|
|
await pgm.sql(`DROP TABLE IF EXISTS store_settings;`);
|
|
};
|