search for: auto_increment

Displaying 20 results from an estimated 311 matches for "auto_increment".

2006 Jul 10
2
use auto_increment before data is stored
Hello, I have 2 models (category with id(auto_increment), name and item with id(auto_increment), category_id, name). But I want to store the data with only one form that creates a new category and the corresponding items at the same time. My problem is now that I don''t know how to tell Ruby to fetch the auto_increment id of the category table...
2006 Mar 01
2
Oracle auto_increment ??? & Rails
To make a new istance of an Oracle table with Rails, i need that this table had a column named ''id''. This ''id'' must be Primary Key & auto_increment;. How Can I modify the ''id'' properties to do it Auto_increment in Oracle? -- Posted via http://www.ruby-forum.com/.
2010 Dec 14
4
Change primary_key column name
Hi, after changing a primary key column name, the auto-increment information (MySQL) and sequence (Oracle) are lost. What is the correct way to rename primary keys? Thanks, Gustavo -- 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
2006 May 17
10
HABTM << producing incorrect insert sql ?
Greetings railsers - I''m trying to add to a collection through HABTM, but the sql insert is trying to insert a PK rather than letting mysql produce the auto_increment''ed PK. ## @medication_dose holds a validated, saved model @medication_dose.medication_frequencies << MedicationFrequency.find (:all) The above bails with, Mysql::Error: #23000Duplicate entry ''1'' for key 1: INSERT INTO medication_dose_frequencies (`med...
2006 May 21
2
MySQL-Front question
...''ve been going through the tutorial here: http://instantrails.rubyforge.org/tutorial/index.html About a third of the way down, right under figure 23 there''s a section on ''Adding Recipe Fields''. I just completed creating a recipes table and the Primary Index and auto_incrementing id have been made. The thing that''s baffling me, is that my results are not exactly like what''s shown in figure 24. More specifically, the null field should be set to no, while mine shows up set to yes. I right-mouse click to check on the properties of id, and the default se...
2006 Mar 21
3
Newbie - ActiveRecord relationships
..._foreign_key => "parent_id", :foreign_key => "task_id" has_many :logs has_many :users, :through => :logs ... My db schema is below. If anyone has some pointers for me I''d REALLY appreciate it. Thanks Nick CREATE TABLE `tasks` ( `id` int(4) NOT NULL auto_increment, `parent_id` int(4) default NULL, #Parent task `title` varchar(100) NOT NULL default '''', `description` text NOT NULL, `estimated_hours` int(4) NOT NULL default ''0'', `start_on` date default NULL, `due_on` date NOT NULL default ''0000-00-00'...
2006 Jan 23
4
won''t auto_increment
I am writing my first RoR ap and am having problems with ActiveRecord''s basic functions. The first one is that the id column is not auto incrementing. I can add one record but after that it says, "Mysql::Error: #23000Duplicate entry ''0'' for key 1"... b -- Posted via http://www.ruby-forum.com/.
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 implement these features seemlessly: 1) auto increment id column 2) foreign key...
2005 Dec 23
4
OO model style: inheritance
...as an owner (user_id) plus some default fields like created_on and updated_on. Futhermore there is an object COMMENT which can be attached to any object that extends NODE (belongs_to NODE). According to this design I modeled the db schema as follows: CREATE TABLE `nodes` ( `id` int(11) NOT NULL auto_increment, `user_id` int(11) NOT NULL default ''0'', `created_on` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `updated_on` timestamp NOT NULL default ''0000-00-00 00:00:00'', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARS...
2006 Mar 09
4
habtm questions
I''ve got some of this working but other parts are ellusive. I have CREATE TABLE `bags` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL default '''', PRIMARY KEY (`id`) CREATE TABLE `packages` ( `id` int(255) NOT NULL auto_increment, `name` varchar(255) NOT NULL default '''', PRIMARY KEY (`id`) CREATE TABLE `bags_packages` ( `id` int(11) NOT NULL auto_in...
2006 Aug 13
0
Custom id field auto_increment increment and offset?
Hi all, in mysql, you can set the following environment variables: set @@auto_increment_offset = 4; set @@auto_increment_increment =10; such that: create table people (id int auto_increment primary key, name char(100)); insert into people set name=''Giuseppe''; insert into people set name=''Laura''; select * from people; +----+----------+ | id | na...
2006 Jun 04
0
auto_increment disappearing
Is anyone else experiencing this? My MySQL tables seem to randomly lose their auto_increment attribute on the id field... -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060604/eebfd479/attachment.html
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 if exists listings; create table listings ( id...
2012 Jan 09
2
create table in mysql using asterisk
Hi, I try to create a new table using MYSQL command in asterisk. This is what i write: Query resultid ${connid} CREATE TABLE IF NOT EXISTS "conference_600" ("id" int(11) NOT NULL auto_increment, "channel_id" varchar(40), "number_in_line" int(2), PRIMARY KEY("id")") and this is the warning that i get in the cli: app_addon_sql_mysql.c:383 aMYSQL_query: aMYSQL_query: mysql_query failed. Error: You have an error in your SQL syntax; check the manual that corr...
2006 Jun 27
1
Help me, I stuck ..
I have three tables and is not allowed to change data scheme: CREATE TABLE `applicants` ( `id` int(10) unsigned NOT NULL auto_increment, `fullname` varchar(60) NOT NULL default '''', `address` varchar(60) NOT NULL default '''', PRIMARY KEY (`id`) ) ; CREATE TABLE `positions` ( `id` int(10) unsigned NOT NULL auto_increment, `position_name` varchar(30) NOT NULL default ''''...
2006 Aug 02
2
many-to-one relationship, do I need a second table?
...mple 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 `locations` ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255), created_at DATETIME, updated_at DATETIME, PRIMARY KEY (id) ) TYPE=''InnoDB''; CREATE TABLE `people` ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255), created_at DATETIME, updated_at DATETIME, location_id INT UNSIGNED, FOREIGN KEY...
2006 Jul 13
5
Relationships: one model referencing same table for different data sets?
Hi, After I''ve saved, I want to display the Description from the Codes table that corresponds with the ID in the Cause table. Rails doesn''t seem to like that, because on my form, I have two sets of data in combo boxes that come from the Codes table. So, in the show template, I can''t do this: Cause of Death: <%= @cause.code.description %> Any ideas? The
2005 Dec 19
2
Difficulty using correct moldel for the data in DB
...the scoop is that item can be fused with another items to create a higher level item. The higher level items can be fused to create even higher level items ... etc. I''m using MySQL to store the data. Here is how I have setup the database: CREATE TABLE `items` ( `id` INTEGER(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) , `cat_id` INTEGER(11), `rank` INTEGER , PRIMARY KEY(`id`) ); CREATE TABLE `cats` ( `id` INTEGER(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(255), PRIMARY KEY(`id`) ); CREATE TABLE `fusions` ( `id` INTEGER(11) NOT NULL AUTO_INCREMENT, `item1_id` INTEGER(11), `ite...
2010 May 01
1
I need some help joining data from 3 MySQL tables, please
..._teams_members" (basically counting all the rows where the corresponding user's id is in the userid field. Then I want to display that same corresponding user's name & email from another table. Table structures to follow: CREATE TABLE `jos_mls_teams` ( `id` int(11) NOT NULL auto_increment, `userid` int(5) NOT NULL, `memberid` int(11) NOT NULL, `name` varchar(255) NOT NULL default '', `email` text, `area` text, `arealeader` varchar(150) NOT NULL, `founded` text, `herder` varchar(100) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_IN...
2007 Aug 05
0
Newbie - Question on Parent child updating
...9;'ve just started Rails and Ruby a week or so ago. Please forgive me for my ignorance. I started writing a small test application to test some of my new knowledge and have hit a wall. Would like some best practices. I have 3 tables, as below... CREATE TABLE `carts` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL, `quantity` int(11) NOT NULL, PRIMARY KEY (`id`) CREATE TABLE `orders` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL, `address` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;...