database-migration

database migration in Yii

时间秒杀一切 提交于 2019-12-03 00:39:05
In order to doing migration in Yii I used this lines <?php class m110714_122129_users extends CDbMigration { public function up() { $this-> createTable('{{users}}',array( 'id' => 'pk', 'username' => 'VARCHAR (80) NOT NULL', 'password' => 'VARCHAR (80) NOT NULL', 'email' => 'VARCHAR (128) NOT NULL', 'activekey' => 'VARCHAR (128) NOT NULL DEFAULT \'\'', 'createtime' => 'INTEGER (10) NOT NULL DEFAULT \'0\' ', 'lastvisit' => 'INTEGER (10) NOT NULL DEFAULT \'0\' ', 'superuser' => 'INTEGER (1) NOT NULL DEFAULT \'0\' ', 'status'=> 'INTEGER (1) NOT NULL DEFAULT \'0\' ', )); } public function down() {

SQL Server: What is the best way to Data Migration? [closed]

白昼怎懂夜的黑 提交于 2019-12-03 00:27:17
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago . I want to migrate data from one database to another database in Microsoft SQL Server 2005. I need to verify those rows retrieved before I insert them to the destination database's tables. Which approach is reasonable for this kind of things? I am trying to use two datasets in

Laravel Fatal Error Class Not Found when migrating

好久不见. 提交于 2019-12-02 21:38:41
I've run artisan migrate:reset . I've deleted some of my migration files because I didn't need these tables anymore. I ran composer dump-autoload followed by artisan dump-autoload I ran artisan migrate and I keep getting this error: PHP Fatal error: Class 'Foo' not found in /vagrant/LaravelBackend/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php on line 297 I tried to: Run again composer dump-autoload and artisan dump-autoload (also used artisan clear-compiled ) Remove the migration table and run artisan migrate:install Remove the vendor and composer.lock file and run

Flyway and liquibase together? [closed]

不想你离开。 提交于 2019-12-02 20:31:33
Closed . This question needs to be more focused. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it focuses on one problem only by editing this post . I've looked at both Liquibase and Flyway individually and on an individual comparison alone, Liquibase seems like the better tool for our needs. Some sources mention using both Liquibase and Flyway together. Liquibase seems to have everything Flyway has and more flexibility when it comes to rollbacks. The main advantage of just Flyway seems to be not having to use XML, but Liquibase

Option for Cascade Delete for References or On Delete

半城伤御伤魂 提交于 2019-12-02 20:21:55
In Rails 4.2, when creating a table or adding a reference via references or add_reference how do you specify that the foreign key should cascade on delete. Command to generate scaffold: rails g scaffold Child parent:references name:string Resulting migration: create_table :childs do |t| t.references :parent, index: true, foreign_key: true t.string :name t.timestamps null: false end This should work create_table :childs do |t| t.references :parent, index: true, foreign_key: {on_delete: :cascade} t.string :name t.timestamps null: false end According to ActiveRecord::ConnectionAdapters:

Handling Schema Migrations in App Engine

a 夏天 提交于 2019-12-02 20:21:25
问题 I've updated several of the heavily-used NDB models in one of my App Engine applications by moving a few properties between them. As such, some models now contain data that previous versions of my application would look to find in different places (and fail in doing so). I have updated my handlers to make sure that this will not happen after I run a migration that will accompany my release. However, I am concerned about what will happen while the schema is migrating. I've tested my migration

Doing a left join with old style joins

走远了吗. 提交于 2019-12-02 17:51:21
问题 So I'm currently transcribing OracleSQL into a new PostgreSQL database. While I'm translating Oracle's (+) joins to LEFT OUTER JOIN s, this works very well. Except when combined with old style joins. Take this OracleSQL for example: SELECT * FROM table1, table2 alias1, table2 alias2, table2 alias3, table3, table4, table5, table6 table6alias WHERE table1.id_table3 = alias1.id_table3 AND table1.id_table4 = alias2.id_table4 AND table1.id_table3 = table3.id_table3 AND table1.id_table4 = table4.id

Rails Migration: Remove constraint

て烟熏妆下的殇ゞ 提交于 2019-12-02 16:53:56
I have a table in a Rails application which (in schema.rb) looks like: create_table "users", :force => true do |t| t.string "name", :null=>false t.string "address", :null=>false end I would like to write a rails migration to allow nulls for the address field. i.e. after the migration the table looks like this: create_table "users", :force => true do |t| t.string "name", :null=>false t.string "address" end What do I need to do to remove the constraint? Not sure you can call t.address ? Anyway... I would use change_column like so change_column :users, :address, :string, :null => true Docs...

Managing mongoid migrations

不羁的心 提交于 2019-12-02 16:40:59
Can someone give me a short introduction to doing DB migrations in Rails using Mongoid? I'm particularly interested in lazy per document migrations. By this, I mean that whenever you read a document from the database, you migrate it to its latest version and save it again. Has anyone done this sort of thing before? I've come across mongoid_rails_migrations , but it doesn't provide any sort of documentation, and although it looks like it does this, I'm not really sure how to use it. I should point out I'm only conceptually familiar with ActiveRecord migrations. If you want to do the entire

Base table or view not found error

别说谁变了你拦得住时间么 提交于 2019-12-02 14:08:32
问题 ProductTable public function up() { Schema::create('product', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('description'); $table->string('type'); $table->integer('size'); $table->integer('price'); $table->string('image')->nullable(); $table->timestamps(); }); } When I hit submit, I got error saying base table not found 回答1: Laravel can not find the prular form of the table name that you used, just specify your table name on your model like so