mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 21:56:10 +02:00
✨ Fix naming inconsistencies on migrations.
This commit is contained in:
parent
7d5f9c1078
commit
7bda554889
11 changed files with 87 additions and 33 deletions
26
backend/resources/migrations/0001-add-extensions.sql
Normal file
26
backend/resources/migrations/0001-add-extensions.sql
Normal file
|
@ -0,0 +1,26 @@
|
|||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
|
||||
|
||||
CREATE FUNCTION update_modified_at()
|
||||
RETURNS TRIGGER AS $updt$
|
||||
BEGIN
|
||||
NEW.modified_at := clock_timestamp();
|
||||
RETURN NEW;
|
||||
END;
|
||||
$updt$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TABLE pending_to_delete (
|
||||
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
|
||||
type text NOT NULL,
|
||||
data jsonb NOT NULL
|
||||
);
|
||||
|
||||
CREATE FUNCTION handle_delete()
|
||||
RETURNS TRIGGER AS $pagechange$
|
||||
BEGIN
|
||||
INSERT INTO pending_to_delete (type, data)
|
||||
VALUES (TG_TABLE_NAME, row_to_json(OLD));
|
||||
RETURN OLD;
|
||||
END;
|
||||
$pagechange$ LANGUAGE plpgsql;
|
Loading…
Add table
Add a link
Reference in a new issue