Displaying 20 results from an estimated 20000 matches similar to: "migration error, mysql, change column limit"
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 =>
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
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, :integer,
{:null=>false,
2008 Oct 21
6
detecting width overflow in serialized column with mysql
So I''ve got an ActiveRecord model pointing to a MySQL db, with an
auto-serialized column ("serialize :columnName").
Thing is, MySQL, depending on how it''s configured (like, by default),
has a bad habit of just truncating your data if it''s too wide for the
column, with no error raised. Yeah, I can probably reconfigure MySQL
and/or my AR connection to it. But
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
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
2009 Jan 07
13
HTTP parse error due to an extra percent sign
If you append an extra percent sign to a URL that gets passed to
mongrel, it will return a Bad Request error. Kind of odd that
"http://localhost/%" causes a "Bad Request" instead of a "Not Found"
error.
Here is the error from the mongrel log:
HTTP parse error, malformed request (127.0.0.1):
#<Mongrel::HttpParserError: Invalid HTTP format, parsing fails.>
2009 Oct 14
18
sybase in rails2?
Has anyone actually gotten the activerecord-sybase-adapter to work in
Rails2?
I can''t seem to, and can''t figure out why. I am on RedHat linux.
I have the sybase client libraries installed, I have the adapter
installed. After installing the patch at
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2455-update-for-sybase_adapter#ticket-2455-4
to get a slightly
2008 Mar 31
14
To surf to URL mydomain.com instead of mydomain.com:3000?
My production server is using mongrel_rails on Ubuntu linux.
With Firefox I can reach my production server with the URL:
www.mydomain.com:3000/
but I can''t reach my production server with the URL
www.mydomain.com/
Is there a way to configure mongrel so that I can reach my
production server with the URL www.mydomain.com?
--
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
2009 Sep 04
1
MySQL BIT column type in ActiveRecord
I''m attempting to access a MySQL BIT(1) column with b''1'' as the data in
the case of a true boolean from within activerecord and am unable to get
any output. The table was created by Hibernate (which uses BIT as it''s
boolean type).
I''ve done a considerable amount of searching on this but have not been
able to find an answer. Am I missing something
2008 Nov 06
10
Rails 2.1.2 bug in include on has_many?
In my continued efforts to port my rails 1.x app to Rails 2.1.2, I keep
running into what appear to be ActiveRecord bugs.
I am using an :include on a :has_many definition:
class Request < ActiveRecord::Base
has_many :service_types, :order=>''service_types.id ASC'',
:include=>:service_response
[...]
There''s no reason this wouldn''t be supported in
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
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
2009 Apr 20
11
manual access to session data outside of request?
So, given a sessionID, I have need to read and write the session stored
information ''manually'', from _outside_ an actual Rails
request/controller.
Readers, I know your first response may be to tell me I don''t really
want to do that. Trust me though, I really do, it makes sense for me in
my case.
I know this wouldn''t work if you''re using the new cookie
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/.
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 Jul 07
5
Re: Rails migration issue
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ok, so rake migrate --trace gets you this:
Khavi:~/Documents/WebCode/rails/clickcaster sgoodwin$ rake migrate --
trace
(in /Users/sgoodwin/Documents/WebCode/rails/clickcaster)
** Invoke migrate (first_time)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Execute migrate
then it
2006 Apr 04
2
loading data with migrations
Hello,
I''m just taking a look at migrations, seems like a fantastic way to maintain
the database. I am wonder if there is a way to maintain what I''ll call
"reference data" along with the migrations. A lot of times in apps your
have tables that have pretty static data, often used to generate select
lists. Is there a way to insert the reference data into these tables
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