![]() ![]() ALTER TABLE subscriptions ADD COLUMN sys_period tstzrange NOT NULL DEFAULT tstzrange ( current_timestamp, null ) You can name it however you want the extension’s convention is to call it sys_period, so we’ll go with that. This is a range showing when this record is valid from - to. Next, we’ll create a subscriptions table: CREATE TABLE subscriptions ( id SERIAL PRIMARY KEY, state text NOT NULL CHECK ( state IN ( 'trial', 'expired', 'active', 'cancelled' )), created_at timestamptz NOT NULL DEFAULT current_timestamp ) įor the temporal functions to work, we also need to add a column to this table which stores the “system period”.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |