Christian R. Garner
2006-May-02 15:28 UTC
[Rails] Tests just deleted my production Database!!! PLEASE
When you run your functional tests, rake wipes the "test" database clean and recreates it based on what is in the "development" database. Since it appears you are using the same database for both, that would explain why you lost your data. In addition, if you omit the data needed to access the development database you will get an error like you described, because it''s trying to read the development database to create the test database. Furthermore, the default database.yml file that gets created with a new rails instance has the following comment right before the "test" database block: # Warning: The database defined as ''test'' will be erased and # re-generated from your development database when you run ''rake''. # Do not set this db to the same as development or production. - Christian On 02/05/06, Jon <jonfgreg@gmail.com> wrote:> > Running the functional tests has deleted the data in my production > database!!! please help!! Using rails 1.1.1 + Oracle. > > This is my database.yml file : > > development: > adapter: oci > host: "V2:1521/TIM" > username: salt > password: oracle1 > > test: > adapter: oci > host: "V2:1521/TIM" > username: rectest > password: oracletest > > production: > adapter: oci > host: "V2:1521/TIM" > username: salt > password: oracle1 > > > How did it happen. It seems impossible
Glenn Stauffer
2006-May-02 15:35 UTC
[Rails] Tests just deleted my production Database!!! PLEASE
In his database.yml file, development and production use the same database schema (salt); test uses a different schema (rectest). Now, if rectest did not have its own set of tables, but instead had full privileges (insert/update/delete) to the production tables with public synonyms hiding the fact that the production tables are in a different schema (making them accessible without the schema prefix), that might explain why rake would wipe the salt (production/development) tables when logged in as rectest. Glenn On 5/2/06, Christian R. Garner <olus@digitalapathy.net> wrote:> > When you run your functional tests, rake wipes the "test" database clean and > recreates it based on what is in the "development" database. Since it > appears you are using the same database for both, that would explain why you > lost your data. In addition, if you omit the data needed to access the > development database you will get an error like you described, because it''s > trying to read the development database to create the test database. > > Furthermore, the default database.yml file that gets created with a new > rails instance has the following comment right before the "test" database > block: > > # Warning: The database defined as ''test'' will be erased and > # re-generated from your development database when you run ''rake''. > # Do not set this db to the same as development or production. > > > - Christian > > On 02/05/06, Jon <jonfgreg@gmail.com> wrote: > > > > Running the functional tests has deleted the data in my production > > database!!! please help!! Using rails 1.1.1 + Oracle. > > > > This is my database.yml file : > > > > development: > > adapter: oci > > host: "V2:1521/TIM" > > username: salt > > password: oracle1 > > > > test: > > adapter: oci > > host: "V2:1521/TIM" > > username: rectest > > password: oracletest > > > > production: > > adapter: oci > > host: "V2:1521/TIM" > > username: salt > > password: oracle1 > > > > > > How did it happen. It seems impossible > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >