-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Curently, the Expand Migrate Contract patern requires to encapsulate each step in different --noqa flags.
Example:
-- Expend column
ALTER TABLE customer
ADD COLUMN last_connection_at_utc timestamp without time zone;
-- Migrate data in new column: datetime in Europe/Paris is converted to UTC
--noqa: disable=LL01
UPDATE customer
SET last_connection_at_utc = (last_connection_at::timestamp without time zone AT TIME ZONE 'Europe/Paris')::timestamp without time zone;
--noqa: enable=LL01
-- Contract column
--noqa: disable=LL06
ALTER TABLE customer
DROP COLUMN last_connection_at;
--noqa: enable=LL06
--noqa: disable=LL05
ALTER TABLE customer
RENAME COLUMN last_connection_at_utc TO last_connection_at;
--noqa: enable=LL05This makes the usage of SQLFluff tideous. This could be improved by adding the Rules involved in the usage of the patern (LL01, LL05 & LL06 in our example) to a new group called EMC. This would enable you to encapsulate the whole pattern.
Example:
--noqa: disable=EMC
-- Expend column
ALTER TABLE customer
ADD COLUMN last_connection_at_utc timestamp without time zone;
-- Migrate data in new column: datetime in Europe/Paris is converted to UTC
UPDATE customer
SET last_connection_at_utc = (last_connection_at::timestamp without time zone AT TIME ZONE 'Europe/Paris')::timestamp without time zone;
-- Contract column
ALTER TABLE customer
DROP COLUMN last_connection_at;
ALTER TABLE customer
RENAME COLUMN last_connection_at_utc TO last_connection_at;
--noqa: enable=EMCMetadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request