NOTICES for sequence after running migration in rails on postgresql Application

Rails (ActiveRecord to be more precise) is adding an id column to your table and making this column the primary key. For PostgreSQL, this column will have type serial. A serial column is essentially a four byte integer combined with a sequence to automatically provide auto-incrementing values. The first notice: NOTICE: CREATE TABLE will create … Read more

Laravel: Run migrations on another database

In your app/config/database.php you have to: <?php return array( ‘default’ => ‘mysql’, ‘connections’ => array( # Our primary database connection ‘mysql’ => array( ‘driver’ => ‘mysql’, ‘host’ => ‘host1’, ‘database’ => ‘database1’, ‘username’ => ‘user1’, ‘password’ => ‘pass1’ ‘charset’ => ‘utf8’, ‘collation’ => ‘utf8_unicode_ci’, ‘prefix’ => ”, ), # Our secondary database connection ‘mysql2’ => … Read more

Database migrations in a complex branching system

I wouldn’t really agree with incremental migrations being rotten. Having a set of homegrown scripts would, in my opinion, be a worse approach than having a real tool for such a job will make tracking those changes easier. I’ve had to deal with a similar situation myself, before, so hopefully I can share some of … Read more

Is there any way to generate sequential Revision IDs in Alembic?

By the sounds of it, you are more interested in sequentially listed revision files rather than sequentially ordered revision ids. The former can be achieved without any change to how the revision ids are generated. The alembic.ini file that is generated when you run alembic init alembic has a section that configures the naming of … Read more

How do I add a check constraint in a Rails migration?

Rails migration does not provide any way to add Constraints, but you can still do it via migration but by passing actual SQL to execute() Create Migration file: ruby script/generate Migration AddConstraint Now, in the migration file: class AddConstraint < ActiveRecord::Migration def self.up execute “ALTER TABLE table_name ADD CONSTRAINT check_constraint_name CHECK (check_column_name IN (1, 2, … Read more

How to change schema of all tables, views and stored procedures in MSSQL

Yes, it is possible. To change the schema of a database object you need to run the following SQL script: ALTER SCHEMA NewSchemaName TRANSFER OldSchemaName.ObjectName Where ObjectName can be the name of a table, a view or a stored procedure. The problem seems to be getting the list of all database objects with a given … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)