Displaying 20 results from an estimated 8000 matches similar to: "Migration - wrong SQL statement is created"
2007 Apr 15
1
help:How to set default value for a column use of migration?
hi,all..
Here i want to use of migration to create a table and set a defult
value for a column..but i cant''t finished..
mycode:
class CreateMessages < ActiveRecord::Migration
def self.up
create_table :messages do |t|
t.column :name, :string
t.column :content, :text
t.column :posttime, :datetime, :default => "now()"
end
end
def
2008 Apr 30
4
Beginner mysql problem
I am new to rails and have come across a problem with a sample
application I was working on.
When trying to use rake migrate I got the error listed below.
my db file contains the following
class ContactDb < ActiveRecord::Migration
def self.up
create_table "people" do |t|
t.column "id", :integer
t.column "name",
2006 Jan 12
1
Best Forum? Was: Migration doesn''t seem to preserve create_table options in schema
Hi,
is this the best forum to answer this question? Is there any better source
for information or another mailinglist to address this question to?
Cheers,
Mariano
---------- Forwarded message ----------
From: Mariano Kamp <mariano.kamp@gmail.com>
Date: Jan 8, 2006 6:24 PM
Subject: Migration doesn''t seem to preserve create_table options in schema
To: rails@lists.rubyonrails.org
2009 Jul 04
3
scaffolding
hi , i used the folllwing command to scaffold,
G:\my\webblog>ruby script/generate scaffold webblog id:integer
title:string body
:text created_at:datetime
after when i migrate with the follwing command
rake db:migrate
i got the error as
(in G:/my/webblog)
== 1 CreateWebblogs: migrating
================================================
-- create_table(:webblogs)
rake aborted!
Mysql::Error:
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 Apr 22
7
Proper Database Design For A Newbie
Hi all,
I am starting out learning Ruby on Rails (coming from a PHP background)
and I have a question about proper database design.
Let me give you a quick example of what I want to do:
Database:
CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`login` varchar(40) default NULL,
`email` varchar(100) default NULL,
`crypted_password` varchar(40) default NULL,
`salt`
2006 Jan 26
9
Problem with schema_db_import on Site5?
Hello,
I am trying to put my rails app on a host .So I presume the method to do
this is to first do
rake db_schema_dump and then copy it to the host and do
rake db_schema_import.
I use mySQL Ver 14.7 Distrib 4.1.14, for pc-linux-gnu (i686) using readline
4.3
** Invoke db_schema_import (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db_schema_import
rake
2006 Mar 15
10
Scaffold with Foreign Key
I have two tables:
------------------------------
drop table if exists users;
create table users (
id int not null auto_increment,
username varchar(100) not null,
password varchar(20) not null,
firstname varchar(20) not null,
lastname varchar(20) not null,
primary key (id)
) TYPE = InnoDB;
------------------------------
drop table
2007 Aug 12
10
about chinese display
hello:
I have built a project with Instant Rails.Now only a database and a
scaffold based on a product model have finished.But when i inputted
"../admin/list" in my browser,i found my chinese characters cound not
display normally.Then i made five steps:
1 ajusting encoding in my browser menu
2 in "C:\InstantRails\conf_files\my.ini"directory,making sure
2015 Jul 06
4
CDR in an MySQL-Database
Hi list!
I'd like to save all information about calls (CDR) in a MySQL-Database.
I created the DB and a user for Asterisk on a separate server, then I
configured my cdr_mysql.conf so:
[global]
hostname=192.168.10.3
dbname=asterisk
table=cdr
password=MYSECRET
user=asterisk
port=3306
and my cdr.conf so:
[general]
enable=yes
unanswered = yes
safeshutdown=yes
[mysql]
usegmtime=no
2005 Dec 23
4
OO model style: inheritance
Hi everybody
I am totally new to rails and I am trying to start a
tiny project to get familiar with rails. But I already
got my first problem and I would be happy if somebody
could point me in the best and cleanest direction.
I am trying to develop a small gallery app. Since I
would like to add more features in future I am trying
to design a clean OO architecture of my models:
The base object
2006 Aug 02
2
many-to-one relationship, do I need a second table?
Ok, to keep things short. Im wondering if I need a secondary
relationship table to handle my many-to-one relationships. Here is an
example of what I''ve written down. For instance say I want to find all
of the people in a given location.
class Location < AR:Base
has_many :people
end
class Person < AR:Base
belongs_to :location
end
My SQL tables look like:
CREATE TABLE
2015 Jul 06
1
CDR in an MySQL-Database
-----Original Message-----
From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of jg
Sent: Monday, July 06, 2015 4:14 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] CDR in an MySQL-Database
> Hi list!
>
> I'd like to save all information about calls (CDR) in a MySQL-Database.
2010 Jun 11
5
Issues creating tables in mysql tests
Hello,
I''m a beginner, so any hints are appreciated; I''m still trying to find my
way around Rails code. For a bug I''ve found I need to create a table called
"values" so I added this:
create_table :values do |t|
t.integer :value
end
among the other table creations in
activerecord/test/cases/migration_test.rb. Is that ok? But then, when I run
the tests
2006 Sep 29
1
newbie Q: it won't display foreign keys...
I have two tables
CREATE TABLE continents (
id int(11) NOT NULL auto_increment,
name varchar(255) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE countries (
id int(11) NOT NULL auto_increment,
name varchar(255) NOT NULL,
continent_id int(11) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
I generate scaffolds for country and for
2006 Apr 22
9
one to many question
1. A category has parent categories.
2. A product is in many categories and a category has many products.
3. Products and category both have images in the same image table. ie. a
product and / or category could have multiple images.<=== my question is
related to this
So among other things I presume I have to do the following:
class Category < ActiveRecord:Base
#...
2005 Jul 05
2
Salted hash login generator (verification problem?)
Hi all,
I hope someone can help with what is probably a simple newb
installation mistake on my part. I''m having a couple of problems with
the salted hash login generator. I installed it following the
quickstart guide, and the unit tests work like a charm. There are two
errors and a failure on the function tests, though; the verified field
seems to be involved in at least one of
2004 Dec 14
3
Problems with app_realtime
It seems that when setting qualify = 200 or qualify = yes in the database for
a sip friend/peer, RealTime does not update the registration status like it
should.
I also have several peers which have been offline and Asterisk still reports
them as registered, even though the registration seconds are only 200.
Asterisk Ver: CVS HEAD 12/1/2004
Layout of sip_buddies:
mysql> describe
2005 Aug 11
5
Realtime + MYSQL
I'm having a few issues with the MySQL realtime configuration in
CVS-HEAD. I tested it initially with realtime extensions (realtime_ext
=> mysql,asterisk,extensions) and a realtime switch in extensions.conf
and that works fine, So I though I'd go back and test a static
configuration mapping.
I used the table structure from the asterisk guru postgres howto to
create something
2006 Apr 02
1
One to Many Relationship Issues
Hi,
I am having issues with a one to many relationship(it never works :-)).
Jokes aside, I am getting an error:
Mysql::Error: #23000Cannot add or update a child row: a foreign key
constraint fails: INSERT INTO adverts (`image_url`, `price`, `title`,
`website_url`, `description`, `user_id`) VALUES(''bb'', 22.0, ''aa'',