Domain_Handler 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3a325c9b481a241b98059ae96a2c98866324c5bc21b9adeaa6671655fdf62c4
4
- data.tar.gz: b23defd160f265cd694192397a611f14390079d0b014f05517cd104258534b87
3
+ metadata.gz: 38b0612dbbb6ab4546623180a1a8ca9125b1499e2f08b82b3e96d3482d47e0e7
4
+ data.tar.gz: a508f3deb9c5ff08ee08aec88bd8afde643feb479956b46912e7d0cb9d8cdbea
5
5
  SHA512:
6
- metadata.gz: ac7e7c6cd501c22eb8029caa99b97b1420a3a5b93b2d066652c97e2b0947284801f6f4388d5fec1b9f6f322467ea07d1fb44a92819cc379ebf27ca00877f06e0
7
- data.tar.gz: 03603d630db697b014175c8396158ffb4a19f2062799e7632bb4aa8cb155ff81b11a9b313fc425b5400f459d1af065a20638c364a123a934f686386bf9a40501
6
+ metadata.gz: 550ea7d0a05c64880e587c7ffc2e90817798adf7ebe39e7f95440337b190b33b9258befbabe94b4216c78e2c9f5bfedbf83debb61bedbc5e5754ff0d8901d94a
7
+ data.tar.gz: 4a5302cf7e5a274720368048aff90db2572bb4e7b9196593116397debf7dd1bbc07120dd3b7462cb59577f2fe2cd54a63cbbaba63e186cb93cdb0eb6ed4d0782
@@ -67,4 +67,42 @@ class DomainHandler
67
67
  localization: params[:localization].to_json
68
68
  )
69
69
  end
70
- end
70
+
71
+ def create_domains
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.4
4
+ version: 0.0.6
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.rb
35
- - lib/generators/doamin_handler/migration/tempates/create_domain_generator.rb
36
34
  homepage: https://rubygems.org/gems/hola
37
35
  licenses:
38
36
  - MIT
@@ -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
@@ -1,20 +0,0 @@
1
- require 'rails/generators'
2
- require 'rails/generators/migration'
3
-
4
- module Domain_Handler
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 'create_domain.rb', 'db/migrate/create_your_table.rb'
13
- end
14
-
15
- def self.next_migration_number(dirname)
16
- Time.now.utc.strftime("%Y%m%d%H%M%S")
17
- end
18
- end
19
- end
20
- end