Displaying 20 results from an estimated 100000 matches similar to: "putting a blob in migrations"
2008 Sep 24
5
Re: save blob to file?
Frederick Cheung wrote:
> On 14 Aug 2008, at 15:11, John Griffiths wrote:
>
>>
>> hope someone can help with this,
>>
>> in my mysql table i''ve got a blob column storing images inside the
>> database, it''s also got the filetype and filesize.
>>
>> now i can work out what the filename will be (e.g. 2002.jpg) but i
>>
2006 Dec 22
0
Problems with MySQL Replication and Migrations
Does anyone have MySQL replication set up for a Rails App that uses
migrations? I''m having an issue where every time I run a migration
Rails is trying to create the schema_info table.
Mysql::Error: Table ''schema_info'' already exists: CREATE TABLE
schema_info (version int(11))
This causes a problem on the slave databases where the replicated
create table statement
2006 Aug 22
5
Creating mysql triggers with migrations blows up
def self.up
execute("delimiter ^ ")
sql = <<-_SQL
CREATE TRIGGER customer_bi BEFORE INSERT ON customers
FOR EACH ROW
BEGIN
SET NEW.sndx = SOUNDEX(NEW.lname) ;
END ^
_SQL
sql.split(''^'').each do |stmt|
execute(stmt) if (stmt.strip! && stmt.length > 0)
end
execute("delimiter ;
2008 Mar 30
3
Bignums, integers and migrations
Hi. I''m using a migration to extract data from one table, to another. In
the process I also convert ip-adresses to integers, for insertion in the
new table.
Problem is that migrations doesn''t seem to handle large numbers very
well. The conversion works fine from the script/console, but when
running it from migrations only very low IP-ranges "make it thru".
2007 May 25
7
Storing large BLOBs in the database with ActiveRecord
I have a model called Product with an attribute called file of
type :binary (DB BLOB). If I do product.save (where product is an
instance of my Product model), here is SQL statement that the mysql
adapter for Ruby will do:
INSERT INTO `PRODUCT` COLUMNS(NAME, PRICE, FILE) VALUES(''PROD1'',
4.56, X''00DEF033423023220'')
All is hunky dory for as long as my BLOB is
2009 Apr 02
3
ID of adapter in migrations
Rails 2.3
How does one identify the adapter that a migration is using? I have
some SQL code that only applies if the postgresql adapter is involved
and I wish to put my execute method inside a suitable conditional.
However, I cannot see a way to get this information from an instance of
ActiveRecord::Migration. Nonetheless, some means must exist for
migrations to work.
How do I ID the DBMS
2007 Mar 25
1
Can't use models in migrations
Hi there,
This always used to work for me... but not now. I want to blame Rails
1.2 but I''m sure its not.
I can''t use AR models in my migrations. To make sure its not just my
dodgy code I tried to do the same with a well known plugin..
acts_as_versioned.
A migration such as the one below (taken from acts_as_versioned) is
giving the error
undefined method
2007 Jan 30
2
How to use migrations to convert engine type to InnoDB?
I''ve been looking through some references but can''t seem to find the
right syntax and commands.
I basically just want to have a migration to convert my db and all my
tables to InnoDB. Does anyone know a tutorial or the migration syntax
to do this? Thanks in advance :-)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are
2007 Dec 16
1
Unit test preperation with migrations
I have spent sometime this afternoon learning how to unit test rails
applications and integrate the Cerberus CI tool. One key area confuses
me however, and I would appreciate other peoples views of how best to
overcome the issue.
My understanding is that the ''test'' and ''test:units'' have the
db:test:prepare pre-requisite which copies the schema from dev to the
2008 Jan 01
1
Migrations under Rails 2.0.2
Have you got migrations to work under Rails 2.0.2. I couldn''t get the
migration to update schema.rb. You too?
http://dev.rubyonrails.org/ticket/10661
f
--~--~---------~--~----~------------~-------~--~----~
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
2009 Mar 10
7
Managing migrations
I have a migration "x" that when it runs self.up it adds a new column
to a table, and of course when self. down is run it deletes said
table...
After I ran this migration I continued to work and in the process
added a couple other migrations. After a while I realized that the
column migration "x" created was a mistake and I no longer need it. So
I ran rake db:migrate:down
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
2009 Apr 11
0
migration oracle auto_increment
I have a schema for ~15 tables in MySQL. I need to migrate it to Oracle
though I''ve never used Oracle before. I see that Oracle doesn''t have an
auto_increment built in. One must create a trigger table for each
auto_incrementing id. I''m contemplating translating my MySQL schema
into a Ruby migration script.
Do you know if Ruby migrations will generate enough SQL to
2007 Sep 12
0
Error when running migrations
I''ve checked out a rails project that i''m working on from a repository,
and created a new database for it. However whenever i try and run the
migrations i get the following error:
rake aborted!
#<AppConfig:0xb7870f84> is not a class/module
Whenever I try to fire up a webrick server, i get the following error:
=> Booting WEBrick...
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
2007 Oct 05
3
Do migration support MySQL BIGINT
hi,
just wondering do migration support MySQL BIGINT ?
what if i wanna create a migration with BIGINT ? should i use SQL
directly ?
kiwi
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
2008 Aug 28
2
Rails Migrations and database views
I have a DB2 schema with many ''views'' and table partitions defined in
it. As per our new project requirement we have to support multiple
databases (DB2,Oracle and MYSQL to be specific). The frontend
application is implemented using Ruby on Rails. I am interested in
exploring the possibility of using Rails Migrations to abstract out
the schema to a DB independent layer. I could
2007 Oct 10
0
migrations on multi-database app
Is it possible to use migrations to manage databases on a multi-database
application?
Example, I need to have the User/Security aspects of the app in one DB
while all the standard app data is in another.
How to manage both DB''s via the migration apparatus?
regards,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
2008 Apr 03
3
Branchable migrations -- A plugin to let you organize your migrations
I just put a new plugin named branchable_migrations on Github.
Branchable migrations lets you separate your migrations into
"branches" (i.e., a director under db/migrate) that each have their
own version. Using the forthcoming UTC timestamped migrations and
this plugin, you can separate migrations by table or feature. Doing
so should alleviate many of the problems that seem to pike up
2007 Sep 23
0
Simple Migration Question: Specifying a key length
Is there any way to create a key length for a text index using
add_index? Whenever I tree and create a text-based, rather than integer
based index, it aborts the rake because I did not specify a key length.
I looked at the add_index documentation, and can''t find a way to specify
this. How do I rectify this error:
Mysql::Error: BLOB/TEXT column ''url'' used in key