Domain_Handler 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d32c49c08c35002adbe7722082dbb18cd70ef1b3b904f868fe60a7fd3992461e
4
- data.tar.gz: 6d9feaaa0f7baf53226d81c704b14a702ffdc50ebc2ade37209fda0f91f76166
3
+ metadata.gz: 067ea9fb828e444500908042c38ab3941a31ed85b32c07b56003dfd4a3a4d3b2
4
+ data.tar.gz: '02329fae234913d445d31e32740afee9f06c8002b5847a7d4565a5551587a55f'
5
5
  SHA512:
6
- metadata.gz: 8afabc81051e39a816402d5d20245ea0218369b71629cb81000da7a56a4b6c7e35c13e48dd084524f9cb08b43031cac1c33b13b09432c089b6763c5049e452fd
7
- data.tar.gz: c74620461e28c47f703ee0deb31ebe3493f8a72ba7893e51a5f69c09cbfb47160543df3689cb9dccfe6356ae69b3bc6725b6fd3a96a3ddc7e425f0ecda602d64
6
+ metadata.gz: 96b892cfe0604a97748c599132a87d500af8102216e2c30c89644702bddc6a8e5808acf44eba56f09901fcc4cd21af3477ecdb1bc2891b10f48276c443550858
7
+ data.tar.gz: 6f07000e7faec550deb4d59c2fc5cccc296bdd97e36f37161ce7758b15264b472e67e4367893befd85800421c97f9737987b076cc4ae52a40505c1046f040651
@@ -67,4 +67,42 @@ class DomainHandler
67
67
  localization: params[:localization].to_json
68
68
  )
69
69
  end
70
- end
70
+
71
+ def self.generate_migration
72
+ require 'active_record'
73
+ require 'active_record/migration'
74
+ # Connect to your database
75
+ ActiveRecord::Base.establish_connection(
76
+ database: ENV['DB_NAME'],
77
+ username: ENV['DB_USER'],
78
+ password: ENV['DB_PWD'],
79
+ host: ENV['HOST_DOMAIN_URL']
80
+ )
81
+
82
+ # Define your migration class
83
+ migration = CreateDomains.new
84
+
85
+ # Create an instance of your migration class
86
+ migration = CreateDomains.new
87
+ # Generate the migration file
88
+ timestamp = Time.now.utc.strftime("%Y%m%d%H%M%S")
89
+ migration_file = "db/migrate/#{timestamp}_create_your_table.rb"
90
+ migration.create_migration_file(migration_file)
91
+ end
92
+ end
93
+
94
+ class CreateDomains < ActiveRecord::Migration[5.0]
95
+ def change
96
+ create_table :domains, id: false, primary_key: :domain_id do |t|
97
+ t.references :shop, foreign_key: true
98
+ t.string :host, null: false, default: ''
99
+ t.string :localization
100
+ t.string :market_web_presence
101
+ t.boolean :ssl_enabled, null: false
102
+ t.string :url
103
+ t.string :domain_id
104
+ t.index :domain_id, unique: true
105
+ t.timestamps
106
+ end
107
+ end
108
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Domain_Handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arun Sahu
@@ -31,8 +31,6 @@ extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
33
  - lib/domain_handler.rb
34
- - lib/generators/doamin_handler/migration/tempates/create_domain_generator.rb
35
- - lib/generators/doamin_handler/migration/tempates/migration.rb
36
34
  homepage: https://rubygems.org/gems/hola
37
35
  licenses:
38
36
  - MIT
@@ -1,20 +0,0 @@
1
- require 'rails/generators'
2
- require 'rails/generators/migration'
3
-
4
- module YourGemName
5
- module Generators
6
- class MigrationGenerator < Rails::Generators::Base
7
- include Rails::Generators::Migration
8
-
9
- source_root File.expand_path('templates', __dir__)
10
-
11
- def create_migration_file
12
- migration_template 'migration.rb', 'db/migrate/create_domains.rb'
13
- end
14
-
15
- def self.next_migration_number(dirname)
16
- ActiveRecord::Generators::Base.next_migration_number(dirname)
17
- end
18
- end
19
- end
20
- end
@@ -1,17 +0,0 @@
1
- class CreateDomains < ActiveRecord::Migration[6.1]
2
- def change
3
- create_table :domains, id: false, primary_key: :domain_id do |t|
4
- t.references :shop, foreign_key: true
5
- t.string :host, null: false, default: ''
6
- t.string :localization
7
- t.string :market_web_presence
8
- t.boolean :ssl_enabled, null: false
9
- t.string :url
10
- t.string :domain_id
11
-
12
- # You probably would want `domain_id` to be unique. In that case...
13
- t.index :domain_id, unique: true
14
- t.timestamps
15
- end
16
- end
17
- end