This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
Foodloop-Server/lib/Pear/LocalLoop/Schema/Result/ViewQuantisedTransactionSQLite.pm

26 lines
769 B
Perl
Raw Normal View History

2017-09-29 13:45:44 +00:00
package Pear::LocalLoop::Schema::Result::ViewQuantisedTransactionSQLite;
use strict;
use warnings;
use base 'DBIx::Class::Core';
__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
__PACKAGE__->table('view_quantised_transactions');
__PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition( qq/
SELECT "value",
"distance",
"purchase_time",
2017-12-15 15:30:47 +00:00
"buyer_id",
"seller_id",
"essential",
2017-09-29 13:45:44 +00:00
DATETIME(STRFTIME('%Y-%m-%d %H:00:00',"purchase_time")) AS "quantised_hours",
2017-12-14 20:30:44 +00:00
DATETIME(STRFTIME('%Y-%m-%d 00:00:00',"purchase_time")) AS "quantised_days",
DATETIME(STRFTIME('%Y-%m-%d 00:00:00',"purchase_time", 'weekday 1')) AS "quantised_weeks"
2017-09-29 13:45:44 +00:00
FROM "transactions"
/);
1;