mirror of
https://github.com/internetee/registry.git
synced 2025-06-12 23:54:44 +02:00
parent
640faaadb9
commit
42e8f86dae
51 changed files with 1619 additions and 53 deletions
8
db/migrate/20181129150515_create_released_domains.rb
Normal file
8
db/migrate/20181129150515_create_released_domains.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
class CreateReleasedDomains < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :released_domains do |t|
|
||||
t.string :name, null: false
|
||||
t.boolean :at_auction, default: false, null: false
|
||||
end
|
||||
end
|
||||
end
|
27
db/migrate/20181212105100_create_auctions.rb
Normal file
27
db/migrate/20181212105100_create_auctions.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
class CreateAuctions < ActiveRecord::Migration
|
||||
def up
|
||||
execute <<-SQL
|
||||
CREATE TYPE auction_status AS ENUM (
|
||||
'open',
|
||||
'closed_without_winner',
|
||||
'closed_with_winner',
|
||||
'payment_received'
|
||||
);
|
||||
SQL
|
||||
|
||||
create_table :auctions do |t|
|
||||
t.string :domain, null: false
|
||||
t.column :status, :auction_status, null: false
|
||||
t.uuid :uuid, default: 'gen_random_uuid()', null: false
|
||||
t.datetime :created_at, null: false
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
execute <<-SQL
|
||||
DROP type auction_status;
|
||||
SQL
|
||||
|
||||
drop_table :auctions
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class ChangeAuctionsUuidDefault < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_default :auctions, :uuid, nil
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class ChangeAuctionsUuidToNotNull < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :auctions, :uuid, false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class RenameReleasedDomainsToDomainNames < ActiveRecord::Migration
|
||||
def change
|
||||
rename_table :released_domains, :domain_names
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class RenameDomainNamesToAuctionableDomains < ActiveRecord::Migration
|
||||
def change
|
||||
rename_table :domain_names, :auctionable_domains
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class RemoveAuctionableDomainsAtAuction < ActiveRecord::Migration
|
||||
def change
|
||||
remove_column :auctionable_domains, :at_auction
|
||||
end
|
||||
end
|
5
db/migrate/20181220094738_remove_auctionable_domains.rb
Normal file
5
db/migrate/20181220094738_remove_auctionable_domains.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class RemoveAuctionableDomains < ActiveRecord::Migration
|
||||
def change
|
||||
drop_table :auctionable_domains
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class RemoveAuctionsNotNullConstraints < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :auctions, :uuid, true
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddAuctionsRegistrationCode < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :auctions, :registration_code, :string
|
||||
end
|
||||
end
|
9
db/migrate/20181226211337_change_auctions_status.rb
Normal file
9
db/migrate/20181226211337_change_auctions_status.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class ChangeAuctionsStatus < ActiveRecord::Migration
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
execute <<-SQL
|
||||
ALTER TYPE auction_status ADD VALUE 'domain_registered' AFTER 'payment_received';
|
||||
SQL
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddPaymentNotReceivedToAuctionStatus < ActiveRecord::Migration
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
execute <<-SQL
|
||||
ALTER TYPE auction_status ADD VALUE 'payment_not_received' AFTER 'payment_received';
|
||||
SQL
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class ChangeAuctionsStatusToString < ActiveRecord::Migration
|
||||
def change
|
||||
change_column :auctions, :status, :string
|
||||
|
||||
execute <<-SQL
|
||||
DROP type auction_status;
|
||||
SQL
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class AddAuctionsRegistrationCodeUniqConstraint < ActiveRecord::Migration
|
||||
def up
|
||||
execute <<-SQL
|
||||
ALTER TABLE auctions ADD CONSTRAINT unique_registration_code UNIQUE (registration_code)
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
execute <<-SQL
|
||||
ALTER TABLE auctions DROP CONSTRAINT unique_registration_code
|
||||
SQL
|
||||
end
|
||||
end
|
5
db/migrate/20190102114702_change_auctions_uuid.rb
Normal file
5
db/migrate/20190102114702_change_auctions_uuid.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class ChangeAuctionsUuid < ActiveRecord::Migration
|
||||
def change
|
||||
change_column :auctions, :uuid, :uuid, null: false, default: 'gen_random_uuid()'
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class AddAuctionsUuidUniqConstraint < ActiveRecord::Migration
|
||||
def up
|
||||
execute <<-SQL
|
||||
ALTER TABLE auctions ADD CONSTRAINT uniq_uuid UNIQUE (uuid)
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
execute <<-SQL
|
||||
ALTER TABLE auctions DROP CONSTRAINT uniq_uuid
|
||||
SQL
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue