Displaying 20 results from an estimated 31 matches for "current_timestamp".
2006 Apr 20
0
Sqlite3 migration and CURRENT_TIMESTAMP
...a problem
with my sqlite3 db. A trivial example of what I''m seeing:
class InitDb < ActiveRecord::Migration
def self.up
create_table :mytable, :force => true do |t|
t.column :lname, :string
t.column :created_at, :string, :default =>
''CURRENT_TIMESTAMP''
end
end
def self.down
end
end
When I dump the SQL from that command (with #to_sql), the
CURRENT_TIMESTAMP field is single quoted. This tells Sqlite3 that you
want to use a string literal as the default, not the CURRENT_TIMESTAMP
function. So, instead of default t...
2005 Dec 23
4
OO model style: inheritance
...hich 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 CHARSET=latin1;
DROP TABLE IF EXISTS `galleries`;
CREATE TABLE `galleries` (
`id` int(11) NOT NULL auto_increment,
`node_...
2006 Jun 12
2
on_update current_timestamp in Migrations
Is there any way to set database columns to auto update a timestamp
column on update?
Can I do something like
t.column "timestamp", :datetime, :default => :current_time, :null
=> false, :on_update => :current_timestamp
or do i need to just use custom sql like
sql = "ALTER TABLE `table` CHANGE `timestamp` `timestamp` TIMESTAMP ON
UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"
exectue sql
Any help is appreciated. Thanks.
--
Posted via http://www.ruby-forum.com/.
2007 Oct 10
1
how can I use a the current_timestamp feature of a database without a magial column
Hi ,
I''m looking for a way to create columns with a default current_stamp
with the db:migrate feature.
--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from
2006 Mar 07
1
PLEASE HELP ,a2billing problem with call duration
...name,nasipaddress,starttime,sessiontime, calledstation, terminatecause, stoptime, calledrate, sessionbill, calledcountry, calledsub, destination, id_tariffgroup, id_tariffplan, id_ratecard, id_trunk, src) VALUES ('1141583953.47', 'SIP/callingcard-50e8', '0474', '', CURRENT_TIMESTAMP - INTERVAL 751 SECOND , '751', '0043***************', 'ANSWER', now(), '1', '12.516666666667', '', '', 'svet', '1', '1', '1', '1', '051359687' )]
[05/03/2006 19:52:37]:[CallerID:051359687]:[CN:0...
2006 Mar 30
15
ActiveRecord 1.13.2 -> 1.14.0 breaks Postgres connectivity
To Whom It May Concern:
I have an ActiveRecord-based application (non-Rails). Life was grand
until I upgraded ActiveRecord yesterday, after which point I was getting
TONNES of these errors from my app and in PostgreSQL''s logs:
FATAL: terminating connection due to administrator command
According to Google searching, this happens when an external process
sends PostgreSQL SIGINT or
2006 Feb 28
0
Confusion with counter and single table inheritance
...rations
CREATE TABLE `jobs` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` char(40) NOT NULL default '''',
`user_id` int(11) NOT NULL default ''0'',
`vents_count` int(11) default ''0'',
`created_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update
CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL default ''0000-00-00 00:00:00'',
`total` decimal(12,2) unsigned default ''0.00'',
`address_id` int(11) NOT NULL default ''0'',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSE...
2006 Mar 07
0
a2billing problem with call duration
...name,nasipaddress,starttime,sessiontime, calledstation, terminatecause, stoptime, calledrate, sessionbill, calledcountry, calledsub, destination, id_tariffgroup, id_tariffplan, id_ratecard, id_trunk, src) VALUES ('1141583953.47', 'SIP/callingcard-50e8', '0474', '', CURRENT_TIMESTAMP - INTERVAL 751 SECOND , '751', '00436642780018', 'ANSWER', now(), '1', '12.516666666667', '', '', 'svet', '1', '1', '1', '1', '051359687' )]
[05/03/2006 19:52:37]:[CallerID:051359687]:[CN:0474]:...
2006 Apr 25
0
Migrate default now()
...ault => ''now''
end
end
#...
end
On postgresql, it is converted to:
created_at timestamp NOT NULL DEFAULT ''2006-04-25
11:34:45.725837''::timestamp without time zone
Modify to:
t.column :created_at, :timestamp, :null => false, :default =>
''current_timestamp''
It is converted to:
created_at timestamp NOT NULL DEFAULT ''current_timestamp''
It''s wrong.
I try to fixed it:
default_fix.rb:
module ActiveRecord
module ConnectionAdapters # :nodoc:
module SchemaStatements
def add_column_options!(sql, options) #:nod...
2005 Mar 03
12
bug in postgresql ''now'' time handling??
...second resolution you might not
notice, but this could lead to subtle errors.
in any case, i may be way off base here : but what i''ve done in the past with
my own postgresql orms is to have a class variable @@now, which gets reset
each time a transaction is started using
select current_timestamp;
and is then used during transaction for any ''now'' -> ruby translations. of
course, if you are not using transactions this must be reset for each
statement. basically some sort of lazy evaluation which depends on the
transaction context is needed to do the mapping of the ...
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
2005 Dec 21
1
Is it a bug?
...m_margin[i];
jitter->longterm_margin[i+1] = jitter->longterm_margin[i];
}
jitter->shortterm_margin[0] = 0;
jitter->longterm_margin[0] = 0;
/*fprintf (stderr, "interpolate frame\n");*/
speex_decode_int(jitter->dec, NULL, out);
if (current_timestamp)
*current_timestamp = jitter->pointer_timestamp;
return;
}
I think , for (i=MAX_MARGIN-2;i>=0;i--) should be replaced by for
(i=MAX_MARGIN-3;i>=0;i--) .
Best regards
keith
2006 Sep 14
0
Lost default value of timestamp field.
...post.rb:
--------------------------------------------------------
class CreatePosts < ActiveRecord::Migration
def self.up
execute <<-EOS
create table posts (
id serial not null primary key,
title varchar(255),
created_at timestamp not null default current_timestamp
);
EOS
end
def self.down
drop_table :posts
end
end
--------------------------------------------------------
when execute "rake migrate", no problem.
but execute "rake db:test:prepare", the default value "default
current_timestamp" not apply to fi...
2006 Nov 17
1
SQLite3 put a parse error in my schema.rb for timestamps
...sql, and if it upgrades, then my tests run it in the
database to create the schema. So the table contains goodies like
these:
drop table chats;
create table chats (
id integer primary key, -- auto_increment,
user_id integer not null,
panel_id integer not null,
uttered_at timestamp DEFAULT CURRENT_TIMESTAMP,
utterance varchar(255) not null
);
(Note, for example, that MySQL will [sometimes] require the
auto_increment, but SQLite can''t use it.)
Now note the timestamp DEFAULT CURRENT_TIMESTAMP. That''s because I''m
too lazy to write Time.now inside the model code for the Ch...
2006 Jun 21
3
Simple range question
I have a model with a datetime field called start_date. I''d like to do
a find on the model so that it returns only records with the start_date
equal to the current day.
Something like this:
@foos = Foo.find(:all,
:conditions => //?? start_date equal to today''s date
??// ] )
Thanks in advance for any help.
-------------- next part
2015 Jan 20
1
Mailbox password change problem on realtime engine
...`exitcontext` char(80) COLLATE utf8_unicode_ci DEFAULT NULL,
`maxmsg` int(5) DEFAULT NULL,
`volgain` decimal(5,2) DEFAULT NULL,
`imapuser` varchar(80) COLLATE utf8_unicode_ci DEFAULT NULL,
`imappassword` varchar(80) COLLATE utf8_unicode_ci DEFAULT NULL,
`stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP,
`welcomeoption` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`category` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`fromstring` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`minsecs` int(11) NOT NULL,
PRIMARY KEY (`uniqueid`)
) ENGINE=MyISAM D...
2005 Dec 15
4
rake migrate ignores '':null => false'' on mysql
I wanted to add a login string column to an existing table
=> I created a migration :
...
def self.up
add_column "members", "login" , :string, :null => false
end
...
remark: it shouldn''t work, as the table is not empty (=> ''login'' would
be null in the existing rows.)
problem:
rake migrate didn''t complain
2018 Nov 15
1
Dovecot proxy: per user/domain 'namespace/inbox/prefix' from MySQL
...ULT NULL,
`ns_inbox_prefix` varchar(255) NOT NULL DEFAULT '',
`lastlog_remote_ips` bigint(20) unsigned NOT NULL DEFAULT 0,
`curlog_remote_ips` bigint(20) unsigned NOT NULL DEFAULT 0,
`disabled_smtpauth` tinyint(1) NOT NULL DEFAULT 0,
`last_modified` timestamp NOT NULL DEFAULT current_timestamp() ON
UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
The 2 queries above return:
MariaDB [postfix]> SELECT NULL AS password, 'Y' as nopassword, host,
'any-cert' as 'starttls', ...
2004 Dec 27
6
realtime voicemail
Paste your extensions.conf section that is relevant.
-Matthew
----- Original Message -----
From: "Greg - Cirelle Enterprises" <gcirino@cirelle.com>
To: <asterisk-dev@lists.digium.com>
Sent: Monday, December 27, 2004 4:32 PM
Subject: [Asterisk-Dev] realtime voicemail
> Let me clarify my last message.
>
> If I put in the wrong password I get polled
> again for
2005 Jul 07
3
NameError Exception
...0) default NULL,
`sig_file` varchar(50) default NULL,
`notary` tinyint(1) NOT NULL default ''0'',
`active` tinyint(1) NOT NULL default ''1'',
`location_id` int(11) default NULL,
`department_id` int(11) default NULL,
`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 CHARSET=utf8 AUTO_INCREMENT=1 ;
===========================
Please help!
Marc
==================DISCLAIMER================================
T...