1
0
Fork 0

Merge migrations

This commit is contained in:
Alex Kotov 2019-09-11 13:17:24 +05:00
parent d5e4edd52e
commit 4db0be18bc
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
5 changed files with 45 additions and 59 deletions

View file

@ -1,20 +0,0 @@
# frozen_string_literal: true
class CreateRSAPublicKeys < ActiveRecord::Migration[6.0]
include Partynest::Migration
def change
create_table :rsa_public_keys do |t|
t.timestamps null: false
t.text :pem, null: false
t.integer :bits, null: false
t.index :pem, unique: true
end
constraint :rsa_public_keys, :bits, <<~SQL
bits in (2048, 4096)
SQL
end
end

View file

@ -1,20 +0,0 @@
# frozen_string_literal: true
class CreateX509CertificateRequests < ActiveRecord::Migration[6.0]
include Partynest::Migration
def change
create_table :x509_certificate_requests do |t|
t.timestamps null: false
t.references :rsa_public_key, null: false, foreign_key: true
t.string :distinguished_name, null: false
t.text :pem, null: false
end
constraint :x509_certificate_requests, :distinguished_name, <<~SQL
is_good_big_text(distinguished_name)
SQL
end
end

View file

@ -1,16 +0,0 @@
# frozen_string_literal: true
class CreateX509Certificates < ActiveRecord::Migration[6.0]
def change
create_table :x509_certificates do |t|
t.timestamps null: false
t.references :x509_certificate_request, null: true, foreign_key: true
t.text :pem, null: false
t.datetime :not_before
t.datetime :not_after
end
end
end

View file

@ -0,0 +1,44 @@
# frozen_string_literal: true
class CreateX509Tables < ActiveRecord::Migration[6.0]
include Partynest::Migration
def change
create_table :rsa_public_keys do |t|
t.timestamps null: false
t.text :pem, null: false
t.integer :bits, null: false
t.index :pem, unique: true
end
constraint :rsa_public_keys, :bits, <<~SQL
bits in (2048, 4096)
SQL
create_table :x509_certificate_requests do |t|
t.timestamps null: false
t.references :rsa_public_key, null: false, foreign_key: true
t.string :distinguished_name, null: false
t.text :pem, null: false
end
constraint :x509_certificate_requests, :distinguished_name, <<~SQL
is_good_big_text(distinguished_name)
SQL
create_table :x509_certificates do |t|
t.timestamps null: false
t.references :x509_certificate_request, null: true, foreign_key: true
t.text :pem, null: false
t.datetime :not_before
t.datetime :not_after
end
end
end

View file

@ -1704,8 +1704,6 @@ INSERT INTO "schema_migrations" (version) VALUES
('20181129203927'),
('20181130024918'),
('20190910040709'),
('20190910115511'),
('20190910133430'),
('20190910225118');
('20190911081459');