lib/generators/motor/templates/install.rb in motor-admin-0.1.41 vs lib/generators/motor/templates/install.rb in motor-admin-0.1.42
- old
+ new
@@ -1,8 +1,8 @@
class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
def self.up
- create_table :motor_queries, force: true do |t|
+ create_table :motor_queries do |t|
t.column :name, :string, null: false
t.column :description, :string
t.column :sql_body, :string, null: false
t.column :preferences, :string, null: false, default: '{}'
t.column :author_id, :integer
@@ -16,11 +16,11 @@
name: 'motor_queries_lower_name_unique_index',
unique: true,
where: 'deleted_at IS NULL'
end
- create_table :motor_dashboards, force: true do |t|
+ create_table :motor_dashboards do |t|
t.column :title, :string, null: false
t.column :description, :string
t.column :preferences, :string, null: false, default: '{}'
t.column :author_id, :integer
t.column :author_type, :string
@@ -33,11 +33,11 @@
name: 'motor_dashboards_lower_title_unique_index',
unique: true,
where: 'deleted_at IS NULL'
end
- create_table :motor_forms, force: true do |t|
+ create_table :motor_forms do |t|
t.column :name, :string, null: false
t.column :description, :string
t.column :api_path, :string, null: false
t.column :http_method, :string, null: false
t.column :preferences, :string, null: false, default: '{}'
@@ -52,29 +52,29 @@
name: 'motor_forms_lower_name_unique_index',
unique: true,
where: 'deleted_at IS NULL'
end
- create_table :motor_resources, force: true do |t|
+ create_table :motor_resources do |t|
t.column :name, :string, null: false, index: { unique: true }
t.column :preferences, :string, null: false, default: '{}'
t.timestamps
t.index :updated_at
end
- create_table :motor_configs, force: true do |t|
+ create_table :motor_configs do |t|
t.column :key, :string, null: false, index: { unique: true }
t.column :value, :string, null: false, default: '{}'
t.timestamps
t.index :updated_at
end
- create_table :motor_alerts, force: true do |t|
+ create_table :motor_alerts do |t|
t.references :query, null: false, foreign_key: { to_table: :motor_queries }, index: true
t.column :name, :string, null: false
t.column :description, :string
t.column :to_emails, :string, null: false
t.column :is_enabled, :boolean, null: false, default: true
@@ -90,39 +90,39 @@
name: 'motor_alerts_lower_name_unique_index',
unique: true,
where: 'deleted_at IS NULL'
end
- create_table :motor_alert_locks, force: true do |t|
+ create_table :motor_alert_locks do |t|
t.references :alert, null: false, foreign_key: { to_table: :motor_alerts }
t.column :lock_timestamp, :string, null: false
t.timestamps
t.index %i[alert_id lock_timestamp], unique: true
end
- create_table :motor_tags, force: true do |t|
+ create_table :motor_tags do |t|
t.column :name, :string, null: false
t.timestamps
t.index 'lower(name)',
name: 'motor_tags_lower_name_unique_index',
unique: true
end
- create_table :motor_taggable_tags, force: true do |t|
+ create_table :motor_taggable_tags do |t|
t.references :tag, null: false, foreign_key: { to_table: :motor_tags }, index: true
t.column :taggable_id, :integer, null: false
t.column :taggable_type, :string, null: false
t.index %i[taggable_id taggable_type tag_id],
name: 'motor_polymorphic_association_tag_index',
unique: true
end
- create_table :motor_audits, force: true do |t|
+ create_table :motor_audits do |t|
t.column :auditable_id, :integer
t.column :auditable_type, :string
t.column :associated_id, :integer
t.column :associated_type, :string
t.column :user_id, :integer