similar to: Dumping schema

Displaying 20 results from an estimated 1000 matches similar to: "Dumping schema"

2006 Jun 30
4
ActiveRecord Migrations, without autonumbered PK''s
I love using ActiveRecord Migrations to build tables. Sometimes, I don''t want to use autogenerated PK''s - I want to set them automatically (why? I''m importing read only data from a large list of medications, and want to use the PK''s assigned by the medication research company...). Is there anyway to do this using Migrations? I know that I don''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
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 Jul 18
2
Scaffold a Plural table w/ No Pluralization in environment
Hi guys, I have a situation here. I have my project set to no pluralization due to legacy tables in environment.rb. Now, I have some new tables which I''m starting to pluralize. When I do a generate a scaffold to this new table: script/generate scaffold my_tables table it seems to work out fine for certain sections like http://mysite.com/railsapp/new (which also inserts properly to
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 ++++++++++++++++++++++----------
2005 Dec 22
2
nonstandard postgresql sequence names
I''m working with a legacy postgresql database where the names of tables, columns, etc., do not usually follow Rails conventions. I''ve been able to work around it for the most part, but I ran into this: I have the following test: require File.dirname(__FILE__) + ''/../test_helper'' class SponsorTest < Test::Unit::TestCase self.use_transactional_fixtures =
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
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 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
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 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
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 21
5
foreign key question
Hi- Say I have a db with following schema: MyTable: Id, name, user_id, date User: id, name, description I know that I want to add "belongs_to" in my "user" model but how can I enforce a proper constraint on the user_id in "MyTable"? Is this done using a has_one in the "MyTable" model? Thanks! --~--~---------~--~----~------------~-------~--~----~ You
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
2005 Nov 12
3
PostgreSQL testing
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hey all, Could the PostgreSQL users in the crowd lend a hand testing http://dev.rubyonrails.org/ticket/2594 on svn trunk against PG 7.4, 8.0, 8.1? We need some more eyeballs in the stew. Thanks! jeremy -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (Darwin) iD8DBQFDdm1oAQHALep9HFYRAjhCAJ4k49808L/K64DX2A2cs8pqeH/SdQCgiab3
2005 Nov 07
0
pk_and_sequence_for(table) bug?
Hi, Doing connection.pk_and_sequence_for doesn''t return anything when I''m positive I''ve got a PK and sequence on my table on column "id", see DDL below. Is this a bug? ?> Player.primary_key => "id" >> Player.connection.default_sequence_name "players" => "players_id_seq" >>
2006 Aug 04
3
Migration::alter statements ??
Hi, Where to put the execute statements in migration scripts? e.g, I would like to create a table and add a foreign_key reference. def self.up ?? execute "alter table ...." create_table :my_table do |t| t.column :user, :string end ?? execute "alter table ...." end Should the execute statement be above the table creation or below the table creation? Logically I
2006 Jul 20
4
Help with Rails and postgres with sequence numbers (global?)
Hello, I am building an Rails applications that has to integrate an legacy system (lxoffice) (schema at: http://www.lx-office.org/uploads/media/DB_Schema_2.1.1_R_393_17_03_2005_.pdf). They somehow use global ids (global for some tables). I can not change the schema and still I want to use Rails to access it and not pure SQL. When I try to insert a record I get the following message:
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
2010 Jun 16
2
class methods from module where active rec is involved
I have a module as shown below and when I extend an active record to use it, I can not access the primary_key method. In a simple test program using a similar approach where active record is not involved, access to the class methods seems to work ok. What can I do to make this work or so that I can access the class methods ? ################################## require