search for: change_column

Displaying 20 results from an estimated 24 matches for "change_column".

2007 Mar 28
1
Migration w/change_column fails on MySQL 5.1
All, I have a migration with statements like this: change_column :quote_input_class_codes, :employee_payroll, :integer, :default => 0, :null => false When I migrate, I get: (in C:/eclipse/workspace/OnlineRating) == DefaultQiccPayrollsToZero: migrating ======================================= -- change_column(:quote_input_class_codes, :employee_payroll, :i...
2012 May 25
2
Typecast values on change_column for postgresql
...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 this is the expected behavior on change_column and I''m not sure but I guess mysql already does that. What you think? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/Sc4AlLJ...
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 => true }) end end Running "rake migrate" indicates everything is ok: == MakeCustomerTypeIdNotNullForCustomers: migrating ======...
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 also looked at the Mysql tables to verify that the migration ran correctly, and the fields...
2009 Jul 24
2
[PATCH server] add collapsable sections to vm form
the vm form is getting cluttered, this patch simply add collapsable sections to the form, making the 'storage' and 'network' sections collapsed by default credit goes to jayg for contributing alot to this patch in terms of simplification and cleanup --- src/app/helpers/application_helper.rb | 4 +- src/app/views/vm/_form.rhtml | 35 ++++++++++++++++++++++----------
2006 Apr 30
4
Migration, BigInts, and string lengths
...s in my unit tests to fail. I understand why the Migration framework doesn''t support this, since not all database engines might support BigInts, but it did catch me by surprise. So, my next idea was to convert the field to text. While I only need 13 characters in this field, using the change_column command with a :string type resulted in a varchar with a length of 255. I tried adding a :size => 13 option (and a :length => 13 option), but it didn''t make any difference. So, my actual question: is there any way to specify the length of a field, or does one just take whatever t...
2009 Jun 19
1
[PATCH server] add collapsable sections to vm form
the vm form is getting cluttered, this patch simply add collapsable sections to the form, making the 'storage' and 'network' sections collapsed by default --- src/app/helpers/application_helper.rb | 9 +++++ src/app/views/vm/_form.rhtml | 55 +++++++++++++++++++++++++-------- src/public/javascripts/ovirt.js | 25 +++++++++++++++
2006 Oct 31
4
Auto-increment lost during migration.
...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 :foo, :foo_id, :bar_id Is this a known problem, any beautiful solution available? Maybe use change_column instead? Best regards, Tobias Nurmiranta --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gman...
2010 Apr 03
2
Specifying a decimal field precision/scale with scaffold requires 2 steps?
...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 :money_field, :amount, :decimal, :precision => 10, :scale => 2 I think this approach worked for me 2.1 Omit the money_field in it''s entirety 2.2 Create a second migration file an add the command: add_column :whatever :money_field, :amount, :decimal, :prec...
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 --~--~---------~--~----~------------~-------~--~----~ You received thi...
2008 Nov 25
1
migration error, mysql, change column limit
..., 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 change_column :requests, :params, :string, :limit => 1024 end end Up works fine. Down tells me: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the...
2006 Jul 12
1
Dumping schema
All, It looks like rake db:schema:dump does not dump primary keys. I have some legacy table that don''t follow the convention ie pk = id and none of the primary keys for these tables are getting dumped... Seems strange as this should be readily available from the db. I am using MySQL. Is anybody else seeing that ? Incidentally how does one specify a primary key using
2006 Oct 15
3
Migrations - add_column :default=>true, :null=>false
This seems pretty brain dead: add_column :types, :notify_on_create, :boolean, {:default=>true, :null=>false} $ rake migrate Error: ERROR: column "notify_on_create" contains null values : ALTER TABLE types ALTER notify_on_create SET NOT NULL Why doesn''t Rails set the new column to true, as it''s supposed to default to? I tried :default=>1 as well (same
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 manual that corresponds to your MySQL server...
2006 Aug 15
0
Problems installing Subscript
...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}) -> 0.1110s -- change_column(:questions, :answered_on, :datetime, {:null=>true}) rake aborted! Mysql::Error: Invalid default value for ''answered_on'': ALTER TABLE questions CHANGE answered_on answered_on datetime DEFAULT '''' Thanks
2006 Apr 07
0
Migrations & Postgres: Change column not functional?
...cash in".) There were some odd bugs when working with the site, and I traced it to two columns which had the "wrong" data types. Actually, they had *earlier* data types: Types that had changed in earlier migrations. It appears that Postgres didn''t execute a number of "change_column" instructions. It''s not clear to me, at this point, whether that was a Postgres error, or something else. Has anyone else seen this behavior? I''m also wondering if this might be version-dependent: I''ve got Postgres 7.4.7and Rails 1.0... -------------- next part -----...
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/.
2006 Oct 20
1
Login Engine, user object "marshal data too short"?
This suddenly started happening to my app today. No code changes, so I expect that this has something to do with a server change. I''m using Login Engine and ActiveRecord sessions. LE stores the whole user object in the session, then pulls it out as needed with UserController#current_user. Out of the blue today this starts failing with the infamous "you''re serializing AR
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 I''ve being told this problem can b...
2012 Mar 02
2
Change DB data type and limited decimals
Rails3.1.3 I have db type, startp:integer I need to change it to float. More specifically, 1.2, 45.1, 143.8 ... I have two questions: 1. Is removing and adding the field through migration the only way? in other words, is there a single command to change the type? 2. Is there anyway to limit the decimal place to only one? 56.3, 34.2... are acceptable, but 23.112, 77.34, ... are