Search
 
SCRIPT & CODE EXAMPLE
 

SQL

ruby on rails db migrate

rails db:migrate
Comment

using SQL in rails migration

def change
  execute <<-SQL
    UPDATE table1
    SET column1 = "value"
  SQL
end
Comment

rails data migration

rails g data_migration FillValuesThisOfThat
Comment

ruby on rails db migrate

namespace :schema do
  desc 'Creates a db/schema.rb file that is portable against any DB supported by Active Record'
  task :dump => [:environment, :load_config] do
    require 'active_record/schema_dumper'
    filename = ENV['SCHEMA'] || File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, 'schema.rb')
    File.open(filename, "w:utf-8") do |file|
      ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)
    end
    db_namespace['schema:dump'].reenable
  end

  desc 'Loads a schema.rb file into the database'
  task :load => [:environment, :load_config, :check_protected_environments] do
    ActiveRecord::Tasks::DatabaseTasks.load_schema_current(:ruby, ENV['SCHEMA'])
  end
Comment

PREVIOUS NEXT
Code Example
Sql :: sql order by two columns 
Sql :: oracle sql average 
Sql :: postgresql concat string with separator 
Sql :: oracle list days between two dates 
Sql :: sql stored procedure with table parameter 
Sql :: between vs in sql 
Sql :: replace tab in sql 
Sql :: Add new column T-SQL 
Sql :: create foreign key postgres 
Sql :: oracle show errors compilation 
Sql :: how to select month from date in sql 
Sql :: sql rename column in select query 
Sql :: mysql limit order by 
Sql :: oracle privileges users 
Sql :: mysql show category once count how many products 
Sql :: bigquery current time 
Sql :: oracle grant directory 
Sql :: choose only one for each distinct collumn regardless of other columns 
Sql :: multiple order by sql 
Sql :: BigQuery Remove Duplicate Keys From Table 
Sql :: get stored procedure text sql server 
Sql :: display first three characters sql 
Sql :: update row postgres 
Sql :: postgres copy command 
Sql :: enum in sql server 
Sql :: UNION ALL LEFT JOIN 
Sql :: demmarrer un service mysql teminal cmd 
Sql :: how to add more columns to a table in mysql 
Sql :: group by sql not ordering issues 
Sql :: postgres show table schema 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =