aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rust/migrations/00000000000000_diesel_initial_setup/down.sql5
-rw-r--r--rust/migrations/00000000000000_diesel_initial_setup/up.sql36
2 files changed, 22 insertions, 19 deletions
diff --git a/rust/migrations/00000000000000_diesel_initial_setup/down.sql b/rust/migrations/00000000000000_diesel_initial_setup/down.sql
index a9f52609..adfa4902 100644
--- a/rust/migrations/00000000000000_diesel_initial_setup/down.sql
+++ b/rust/migrations/00000000000000_diesel_initial_setup/down.sql
@@ -2,5 +2,6 @@
-- and other internal bookkeeping. This file is safe to edit, any future
-- changes will be added to existing projects as new migrations.
-DROP FUNCTION IF EXISTS diesel_manage_updated_at(_tbl regclass);
-DROP FUNCTION IF EXISTS diesel_set_updated_at();
+SELECT 1;
+-- DROP FUNCTION IF EXISTS diesel_manage_updated_at(_tbl regclass);
+-- DROP FUNCTION IF EXISTS diesel_set_updated_at();
diff --git a/rust/migrations/00000000000000_diesel_initial_setup/up.sql b/rust/migrations/00000000000000_diesel_initial_setup/up.sql
index 3400c7c5..f89156f7 100644
--- a/rust/migrations/00000000000000_diesel_initial_setup/up.sql
+++ b/rust/migrations/00000000000000_diesel_initial_setup/up.sql
@@ -16,22 +16,24 @@
--
-- SELECT diesel_manage_updated_at('users');
-- ```
-CREATE OR REPLACE FUNCTION diesel_manage_updated_at(_tbl regclass) RETURNS VOID AS $$
-BEGIN
- EXECUTE format('CREATE TRIGGER set_updated_at BEFORE UPDATE ON %s
- FOR EACH ROW EXECUTE PROCEDURE diesel_set_updated_at()', _tbl);
-END;
-$$ LANGUAGE plpgsql;
-CREATE OR REPLACE FUNCTION diesel_set_updated_at() RETURNS trigger AS $$
-BEGIN
- IF (
- NEW IS DISTINCT FROM OLD AND
- NEW.updated_at IS NOT DISTINCT FROM OLD.updated_at
- ) THEN
- NEW.updated_at := current_timestamp;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE plpgsql;
+-- CREATE OR REPLACE FUNCTION diesel_manage_updated_at(_tbl regclass) RETURNS VOID AS $$
+-- BEGIN
+-- EXECUTE format('CREATE TRIGGER set_updated_at BEFORE UPDATE ON %s
+-- FOR EACH ROW EXECUTE PROCEDURE diesel_set_updated_at()', _tbl);
+-- END;
+-- $$ LANGUAGE plpgsql;
+-- CREATE OR REPLACE FUNCTION diesel_set_updated_at() RETURNS trigger AS $$
+-- BEGIN
+-- IF (
+-- NEW IS DISTINCT FROM OLD AND
+-- NEW.updated_at IS NOT DISTINCT FROM OLD.updated_at
+-- ) THEN
+-- NEW.updated_at := current_timestamp;
+-- END IF;
+-- RETURN NEW;
+-- END;
+-- $$ LANGUAGE plpgsql;
+
+SELECT 1