diff --git a/db/migrate/20190910115511_create_rsa_public_keys.rb b/db/migrate/20190910115511_create_rsa_public_keys.rb deleted file mode 100644 index 54f81a1..0000000 --- a/db/migrate/20190910115511_create_rsa_public_keys.rb +++ /dev/null @@ -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 diff --git a/db/migrate/20190910133430_create_x509_certificate_requests.rb b/db/migrate/20190910133430_create_x509_certificate_requests.rb deleted file mode 100644 index 914fa1c..0000000 --- a/db/migrate/20190910133430_create_x509_certificate_requests.rb +++ /dev/null @@ -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 diff --git a/db/migrate/20190910225118_create_x509_certificates.rb b/db/migrate/20190910225118_create_x509_certificates.rb deleted file mode 100644 index aef1ef5..0000000 --- a/db/migrate/20190910225118_create_x509_certificates.rb +++ /dev/null @@ -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 diff --git a/db/migrate/20190911081459_create_x509_tables.rb b/db/migrate/20190911081459_create_x509_tables.rb new file mode 100644 index 0000000..5ddcdf4 --- /dev/null +++ b/db/migrate/20190911081459_create_x509_tables.rb @@ -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 diff --git a/db/structure.sql b/db/structure.sql index 00789cf..f1dfbd0 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1704,8 +1704,6 @@ INSERT INTO "schema_migrations" (version) VALUES ('20181129203927'), ('20181130024918'), ('20190910040709'), -('20190910115511'), -('20190910133430'), -('20190910225118'); +('20190911081459');