start new:
tmux
start new with session name:
tmux new -s myname
| # db/migrate/20131118172653_create_transactional_items_view.rb | |
| class CreateTransactionalItemsView < ActiveRecord::Migration | |
| def up | |
| select_sql = File.open("#{Rails.root}/db/migrate/20131118172653_create_transactional_items_view.sql", 'r') { |f| f.read } | |
| # for materialized view: | |
| view_sql = "CREATE MATERIALIZED VIEW transactional_items AS (#{select_sql})" | |
| # for normal view: | |
| view_sql = "CREATE VIEW transactional_items AS (#{select_sql})" | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>comment</key> | |
| <string> | |
| TODO: unresolved issues | |
| text: |
| DROP TABLE if exists d_date; | |
| CREATE TABLE d_date | |
| ( | |
| date_dim_id INT NOT NULL, | |
| date_actual DATE NOT NULL, | |
| epoch BIGINT NOT NULL, | |
| day_suffix VARCHAR(4) NOT NULL, | |
| day_name VARCHAR(9) NOT NULL, | |
| day_of_week INT NOT NULL, |
| # (I recommend understanding the basics of this first: http://sequel.jeremyevans.net/rdoc/files/doc/object_model_rdoc.html) | |
| # Extending the underlying dataset (http://sequel.jeremyevans.net/rdoc/files/README_rdoc.html#label-Extending+the+underlying+dataset) | |
| # The recommended way to implement table-wide logic by defining methods on the dataset using dataset_module: | |
| class Post < Sequel::Model | |
| dataset_module do | |
| def posts_with_few_comments | |
| where{num_comments < 30} |