Initial commit
This commit is contained in:
44
db/migrate/20210903155122_devise_create_admin_users.rb
Normal file
44
db/migrate/20210903155122_devise_create_admin_users.rb
Normal file
@@ -0,0 +1,44 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class DeviseCreateAdminUsers < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :admin_users do |t|
|
||||
## Database authenticatable
|
||||
t.string :email, null: false, default: ""
|
||||
t.string :encrypted_password, null: false, default: ""
|
||||
|
||||
## Recoverable
|
||||
t.string :reset_password_token
|
||||
t.datetime :reset_password_sent_at
|
||||
|
||||
## Rememberable
|
||||
t.datetime :remember_created_at
|
||||
|
||||
## Trackable
|
||||
# t.integer :sign_in_count, default: 0, null: false
|
||||
# t.datetime :current_sign_in_at
|
||||
# t.datetime :last_sign_in_at
|
||||
# t.string :current_sign_in_ip
|
||||
# t.string :last_sign_in_ip
|
||||
|
||||
## Confirmable
|
||||
# t.string :confirmation_token
|
||||
# t.datetime :confirmed_at
|
||||
# t.datetime :confirmation_sent_at
|
||||
# t.string :unconfirmed_email # Only if using reconfirmable
|
||||
|
||||
## Lockable
|
||||
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
||||
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
||||
# t.datetime :locked_at
|
||||
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :admin_users, :email, unique: true
|
||||
add_index :admin_users, :reset_password_token, unique: true
|
||||
# add_index :admin_users, :confirmation_token, unique: true
|
||||
# add_index :admin_users, :unlock_token, unique: true
|
||||
end
|
||||
end
|
||||
16
db/migrate/20210903155123_create_active_admin_comments.rb
Normal file
16
db/migrate/20210903155123_create_active_admin_comments.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class CreateActiveAdminComments < ActiveRecord::Migration[6.1]
|
||||
def self.up
|
||||
create_table :active_admin_comments do |t|
|
||||
t.string :namespace
|
||||
t.text :body
|
||||
t.references :resource, polymorphic: true
|
||||
t.references :author, polymorphic: true
|
||||
t.timestamps
|
||||
end
|
||||
add_index :active_admin_comments, [:namespace]
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :active_admin_comments
|
||||
end
|
||||
end
|
||||
32
db/migrate/20210903161117_create_subscriptions.rb
Normal file
32
db/migrate/20210903161117_create_subscriptions.rb
Normal file
@@ -0,0 +1,32 @@
|
||||
class CreateSubscriptions < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :subscriptions do |t|
|
||||
t.string :contact
|
||||
t.integer :licenses_count
|
||||
t.string :name
|
||||
t.string :supplier_name
|
||||
t.string :industry_name
|
||||
t.string :product_name
|
||||
t.integer :licese_type
|
||||
t.integer :max_users
|
||||
t.date :starts_at
|
||||
t.date :ends_at
|
||||
t.integer :active_licenses_count
|
||||
t.text :notes
|
||||
t.boolean :is_autorenew
|
||||
t.integer :autorenew_duration
|
||||
t.string :autorenew_duration_unit, :duration_unit, null: false, default: 'month'
|
||||
t.date :autorenew_deadline
|
||||
t.string :billing_frequency
|
||||
t.string :contract_entity_name
|
||||
t.date :autorenew_voided_at
|
||||
t.date :renewed_at
|
||||
t.decimal :retention, precision: 17, scale: 2, null: true
|
||||
t.string :limit
|
||||
t.integer :retention_currency_id
|
||||
t.boolean :has_percentage_discount_type
|
||||
t.boolean :has_flat_fare_discount_type
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
24
db/migrate/20210907143616_create_employers.rb
Normal file
24
db/migrate/20210907143616_create_employers.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
class CreateEmployers < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :employers do |t|
|
||||
t.string "name"
|
||||
t.string "logo_url"
|
||||
t.string "short_name"
|
||||
t.string "short_code"
|
||||
t.integer "users_count", default: 0
|
||||
t.integer "subscriptions_count", default: 0
|
||||
t.string "status"
|
||||
t.boolean "user_set_status", default: false
|
||||
t.bigint "primary_contact_id"
|
||||
t.integer "savings_report_frequency_in_months", default: 3, null: false
|
||||
t.date "first_joined_at"
|
||||
t.string "org_type", default: "member", null: false
|
||||
t.bigint "asana_assignee_id"
|
||||
t.index ["asana_assignee_id"], name: "index_employers_on_asana_assignee_id"
|
||||
t.index ["first_joined_at"], name: "index_employers_on_first_joined_at"
|
||||
t.index ["org_type"], name: "index_employers_on_org_type"
|
||||
t.index ["primary_contact_id"], name: "index_employers_on_primary_contact_id"
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddEmployerToSubscription < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_reference :subscriptions, :employer, null: false, foreign_key: true
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddSeriesSuccessorIdToSubscriptions < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :subscriptions, :series_successor_id, :integer
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddSeriesTerminatedAtToSubscriptions < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :subscriptions, :terminated_at, :date
|
||||
end
|
||||
end
|
||||
8
db/migrate/20210917144712_create_suppliers.rb
Normal file
8
db/migrate/20210917144712_create_suppliers.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class CreateSuppliers < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :suppliers do |t|
|
||||
t.string "name"
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
11
db/migrate/20210917144722_create_products.rb
Normal file
11
db/migrate/20210917144722_create_products.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class CreateProducts < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :products do |t|
|
||||
t.string "name"
|
||||
t.bigint "industry_id"
|
||||
t.bigint "supplier_id"
|
||||
t.string "description"
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user