Displaying 20 results from an estimated 9000 matches similar to: "Migration w/change_column fails on MySQL 5.1"
2012 May 25
2
Typecast values on change_column for postgresql
Hello,
Currently if you have a string column that have only number values (think a
year column using string by mistake) and you want to change to integer, you
can''t.
If you apply this monkey-patch will be possible:
https://gist.github.com/1393441
Note: if some value can''t be casted by postgresql (if have a letter for
example), the migration will fail as expected.
I think
2008 Nov 25
1
migration error, mysql, change column limit
Hmm, one of my migrations have stopped working on #down. It still works
on #up. (It''s also possible that I never tested it for #down before, and
it never worked, heh.)
I can''t figure out why not. Pretty simple.
class WidenRequestParams < ActiveRecord::Migration
def self.up
change_column :requests, :params, :string, :limit => 2048
end
def self.down
2006 Jul 01
1
Changing column to NOT NULL with migration silently failing.
Hi
I''ve created a migration called
make_customer_type_id_not_null_for_customers. The migration .rb file
looks like this:
class MakeCustomerTypeIdNotNullForCustomers < ActiveRecord::Migration
def self.up
change_column(:customers, :customer_type_id, :integer, { :null => false })
end
def self.down
change_column(:customers, :customer_type_id, :integer, { :null =>
2008 Jan 19
1
Decimals are being converted to Bigdecimals!!!!!
Hi all,
I''m working on a financial app, and have set up some columns in my
tables as decimals with precision => 8 and scale => 2. My migration
looks like:
change_column :lineitems, :price, :decimal, :precision =>
8, :scale => 2
change_column :payments, :amount, :decimal, :precision =>
8, :scale => 2
I''ve run the migration and restarted the server. I
2006 Mar 20
4
Ajax.Request w/standard redirect doesn''t render
I am doing an Ajax call in my page to a controller method like so:
new Ajax.Request(''<%= url_for(:action => "target_list_add" )%>'', {
asynchronous:true });"
In my controller method "target_list_add", I do something and then I
say:
redirect_to( :action => ''target_list_upload'', :layout => false )
I know for certain
2006 Apr 30
4
Migration, BigInts, and string lengths
Howdy Y''all,
I was thrilled to recently discover migrations, as that framework
addresses a common problem in an elegant way. I have, however, gotten
tripped up a bit as I''ve worked with them.
The first problem I encountered was that, though I was using a BigInt
data type in a field in my dev database, my unit tests were failing
because when I copied the schema from the dev
2006 Nov 13
1
Removing column default with a migration
Hi guys,
I''m having problems removing the default from a boolean field. I''m using the
following statement:
change_column :valuations, :too_many_adults, :integer, :null => true
but it''s adding DEFAULT ''0'' to the SQL statement. I''m having no luck using
change_column_default either. Is this possible?
Gareth
2007 Mar 02
12
Prototype: Ajax.Request w/asynchronous: false
All,
I have the following Ajax call:
new Ajax.Request(action, {asynchronous: false,
method: ''post'',
parameters: params_to_pass,
evalScripts: true});
The action that I''m calling is using render :update to send back
Javascript. When asynchronous is set to true above, then the Javascript
is executed (because of evalScripts:
2008 Nov 25
21
"mysql" 2.7.3 gem install for Windows appears incomplete
When I install the 2.7.3 "mysql" gem on Windows XP (trying to prepare
for the requirement to use the mysql gem in Rails 2.2.2) by using:
gem install mysql
I get a mysql-2.7.3-x86-mswin32 directory under gems, but underneath
that, only a docs directory, an ext directory, and README, Rakefile and
.require_paths.
I then cannot do any connecting to my MySQL databases.
Shouldn''t
2006 Oct 31
4
Auto-increment lost during migration.
Hi. I get some strange results when using rename_column on a primary
key in a migration. It seems like the migration script removes the
auto-increment property if you rename a column.
This is a minimal example.
create_table :foo, :primary_key => :foo_id do |t|
t.column "name", :string
end
# renaming the primary key makes auto-increment disappear.
rename_column
2010 Apr 03
2
Specifying a decimal field precision/scale with scaffold requires 2 steps?
Hi,
It appears to me that the command:
ruby script/generate scaffold whatever money_field:decimal(10,2)
will not generate a valid migration.
Therefore it appears to me only two ways to achieve the desired result
is:
1.1 Omit the the precision/scale on the scaffold command
1.2 Edit the migration file by following the "do |t| ... end" with
the command:
change_column :whatever
2008 Mar 19
5
object_transactions plugin w/2.x disables AR session store
All,
Win XP
Rails 2.0.2
object_transactions plugin
(http://code.bitsweat.net/svn/object_transactions/)
transaction-simple gem 1.4 (required by object_transactions plugin)
AR SQL Server Adapter 1.0
SQL Server 2000
Using the object_transactions plugin with Rails 2.0.2 (and I assume
based on what I''m seeing that this goes for Rails 2.x) disables the
ability to save to an ActiveRecord based
2006 Aug 14
0
MediumText with Rails Migrations
Hi,
I''m trying to figure out how to reliably define a column as mediumtext
type through a migration.
First I tried this:
change_column( :entries, :lines, :text, :limit => 2.megabytes )
It worked fine for my development box on MySQL 5.0, but when I tried
it on my production box with MySQL 4.0, it gave the following error:
MysqlError: You have an error in your SQL syntax. Check the
2006 Aug 15
0
Problems installing Subscript
Has any one installed subscript engine. I having trouble completing the
installation: When I run
rake db:migrate:engines:substruct I get the following error;
(in /Users/peterw/railsapps/webprint)
Migrating engine ''substruct''
== AddUserAndContact: migrating
===============================================
-- add_column(:questions, :email_address, :string, {:limit=>50})
2006 Apr 07
0
Migrations & Postgres: Change column not functional?
I''ve got a MySQL app, which I''m moving to a new server which is using
Postgres. This seems like the perfect application of migrations. (Note: I
don''t mean "using migrations to switch from MySQL to Postgres" so much as
"Hey, I''ve _been_ using migrations all along, and this is where I cash in".)
There were some odd bugs when working with the
2005 Dec 19
0
specifying unsigned type in rake migration
I''m using rake migration for mySql database changes. I''ve so far been
unable to uncover a way to specify that an integer field is unsigned.
You can do it in mySql, but I can''t find the correct argument for the
change_column method. Is there one?
--
Posted via http://www.ruby-forum.com/.
2011 Sep 12
0
Migrate column from text to binary (PostgreSQL)
Hello,
So I''ve realized one of the columns in a table has to be binary
instead of text. However, a straightforward
change_column :my_table, :my_column, :binary
fails under PostgreSQL (9.x series) The error message being:
PGError: ERROR: column "my_column" cannot be cast to type bytea
: ALTER TABLE "my_table" ALTER COLUMN "my_column" TYPE bytea
Now
2006 Apr 13
1
What is the working directory for fastcgi procs w/Apache 2?
When running Apache and FastCGI with Rails, what determines the current
working directory?
Is there an easy way to discover which directory this is at runtime?
WG
--
Posted via http://www.ruby-forum.com/.
2007 Jul 23
0
Problem w/ MySQL update from perl AGI script
I've been trying to get a basic 5 question IVR survey working in an AGI script,
and am having trouble with the SQL portion not updating the table. When I take
out all the AGI references, and run just the perl script, the table updates
with no problem(DBname,username,password have been substituted in this example
for the actual values):
#!/usr/bin/perl
#
#
use DBI;
$DATETIME =
2008 Jul 22
0
Problems w/Asterisk Realtime + MySQL + SIP [SOLVED!]
After upgrading to 1.4.21.1 I received some more verbose debug messages.
Apparently the cause of the problem was that the following table
columns MUST exist for a SIP peer to register.
ipaddr (i used varchar(32))
port (i used int unsigned)
regseconds (i used bigint unsigned)
This is apparently because realtime stores the IP address, port and
registration time for a dynamic IP, realtime peer