|
|
|
@ -2,12 +2,13 @@
|
|
|
|
|
|
|
|
|
|
class SequenceForAutomatedFeatureFlags < Sequel::Migration
|
|
|
|
|
START_SEQ_NUMBER = -1000
|
|
|
|
|
NAME = 'machine_added_feature_flags_id_seq'
|
|
|
|
|
|
|
|
|
|
def up
|
|
|
|
|
# Create sequence to avoid trouble generating unique ids
|
|
|
|
|
# It starts in negative numbers and goes downward in order to be able to identify quickly flags added automatically
|
|
|
|
|
Rails::Sequel.connection.run(%Q{
|
|
|
|
|
CREATE SEQUENCE machine_added_feature_flags_id_seq INCREMENT BY -1
|
|
|
|
|
CREATE SEQUENCE #{NAME} INCREMENT BY -1
|
|
|
|
|
START WITH #{START_SEQ_NUMBER}
|
|
|
|
|
OWNED BY feature_flags.id;
|
|
|
|
|
})
|
|
|
|
@ -15,7 +16,7 @@ class SequenceForAutomatedFeatureFlags < Sequel::Migration
|
|
|
|
|
|
|
|
|
|
def down
|
|
|
|
|
Rails::Sequel.connection.run(%Q{
|
|
|
|
|
DROP SEQUENCE IF EXISTS machine_added_feature_flags_id_seq;
|
|
|
|
|
DROP SEQUENCE IF EXISTS #{NAME}
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|