mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 13:44:47 +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
|
|
@ -402,6 +402,39 @@ CREATE SEQUENCE public.actions_id_seq
|
|||
ALTER SEQUENCE public.actions_id_seq OWNED BY public.actions.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: auctions; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE public.auctions (
|
||||
id integer NOT NULL,
|
||||
domain character varying NOT NULL,
|
||||
status character varying NOT NULL,
|
||||
uuid uuid DEFAULT public.gen_random_uuid() NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
registration_code character varying
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: auctions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.auctions_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: auctions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.auctions_id_seq OWNED BY public.auctions.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: bank_statements; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
@ -2527,6 +2560,13 @@ ALTER TABLE ONLY public.accounts ALTER COLUMN id SET DEFAULT nextval('public.acc
|
|||
ALTER TABLE ONLY public.actions ALTER COLUMN id SET DEFAULT nextval('public.actions_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.auctions ALTER COLUMN id SET DEFAULT nextval('public.auctions_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -2922,6 +2962,14 @@ ALTER TABLE ONLY public.actions
|
|||
ADD CONSTRAINT actions_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: auctions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.auctions
|
||||
ADD CONSTRAINT auctions_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: bank_statements_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
@ -3322,6 +3370,14 @@ ALTER TABLE ONLY public.domains
|
|||
ADD CONSTRAINT uniq_domain_uuid UNIQUE (uuid);
|
||||
|
||||
|
||||
--
|
||||
-- Name: uniq_uuid; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.auctions
|
||||
ADD CONSTRAINT uniq_uuid UNIQUE (uuid);
|
||||
|
||||
|
||||
--
|
||||
-- Name: unique_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
@ -3354,6 +3410,14 @@ ALTER TABLE ONLY public.registrars
|
|||
ADD CONSTRAINT unique_reference_no UNIQUE (reference_no);
|
||||
|
||||
|
||||
--
|
||||
-- Name: unique_registration_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.auctions
|
||||
ADD CONSTRAINT unique_registration_code UNIQUE (registration_code);
|
||||
|
||||
|
||||
--
|
||||
-- Name: unique_session_id; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
@ -4864,5 +4928,37 @@ INSERT INTO schema_migrations (version) VALUES ('20181002090319');
|
|||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181108154921');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181129150515');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181212105100');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181212145456');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181212145914');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181213113115');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181217144701');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181217144845');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181220094738');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181220095053');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181223153407');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181226211337');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181227155537');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181227172042');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181230231015');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20190102114702');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20190102115333');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20190102144032');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue