lakesare / memcode

Spaced-repetition: with real formatting.
http://memcode.com
MIT License
335 stars 72 forks source link

Create a migration to turning all timezone('UTC', now()) into now(). #51

Closed lakesare closed 4 years ago

lakesare commented 4 years ago

image

The TIMEZONE setting changed recently on memcode. Everything that's timezone('UTC', now()) in schema should be just now() now.

Please create the migration backend/db/migrations/12.sql that will change all these fields in db too.

lakesare commented 4 years ago

To whomever takes this issue, - please add

ON DELETE CASCADE to the user_id too.

CREATE TABLE coauthor (
  id SERIAL PRIMARY KEY,
  created_at TIMESTAMP NOT NULL DEFAULT timezone('UTC', now()),

  user_id INTEGER REFERENCES "user" (id) NOT NULL,
  course_id INTEGER REFERENCES course (id) ON DELETE CASCADE NOT NULL,

  unique (user_id, course_id)
);
lakesare commented 4 years ago

Done ✅