Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create schema in sql

As per http://edgeguides.rubyonrails.org/configuring.html and this post I have this in application.rb

config.active_record.schema_format = :sql 

However, it's still creating db/schema.rb (even after I delete it) and more importantly it's not creating the schema in sql when I run "rake db:migrate". Anyone know what I'm doing wrong? I'm on Rails 3.1 pre.

like image 612
vince Avatar asked Aug 12 '11 02:08

vince


People also ask

What is a schema SQL?

What is Schema in SQL? In a SQL database, a schema is a list of logical structures of data. A database user owns the schema, which has the same name as the database manager. As of SQL Server 2005, a schema is an individual entity (container of objects) distinct from the user who constructs the object.

How do I get SQL schema?

You can get a list of the schemas using an SSMS or T-SQL query. To do this in SSMS, you would connect to the SQL instance, expand the SQL database and view the schemas under the security folder. Alternatively, you could use the sys. schemas to get a list of database schemas and their respective owners.

How do I create a new schema in MySQL?

Steps to create a schema in MySQLOpen the MySQL Workbench. Click the Create Schema option. Provide a schema name. Click apply to create the MySQL scheme.


1 Answers

Well, this could be a rails bug, but you can always generate your db structure with this:

rake db:structure:dump 

This is going to generate an "#{Rails.env}.sql" file for you with your database structure in SQL.

like image 110
Maurício Linhares Avatar answered Sep 28 '22 12:09

Maurício Linhares