2018-10-16 13:25:41 +03:00
|
|
|
type: bulk
|
|
|
|
args:
|
|
|
|
|
|
|
|
#Author table
|
2021-01-06 19:06:24 +03:00
|
|
|
|
2018-10-16 13:25:41 +03:00
|
|
|
- type: run_sql
|
|
|
|
args:
|
|
|
|
sql: |
|
|
|
|
create table author(
|
2019-04-08 10:22:38 +03:00
|
|
|
id serial primary key,
|
|
|
|
name text unique,
|
2018-10-16 13:25:41 +03:00
|
|
|
is_registered boolean not null default false
|
|
|
|
);
|
|
|
|
CREATE TABLE article (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
title TEXT,
|
|
|
|
content TEXT,
|
|
|
|
author_id INTEGER REFERENCES author(id),
|
|
|
|
is_published BOOLEAN,
|
|
|
|
published_on TIMESTAMP
|
2021-01-06 19:06:24 +03:00
|
|
|
);
|
|
|
|
create view author_simple as
|
|
|
|
select * from author;
|
|
|
|
create view author_complex as
|
|
|
|
select a.id as author_id, b.title as article_title
|
|
|
|
from author a join article b on (a.id = b.author_id);
|
|
|
|
|
|
|
|
- type: track_table
|
|
|
|
args:
|
|
|
|
schema: public
|
|
|
|
name: author
|
|
|
|
|
|
|
|
#Article table
|
2018-10-16 13:25:41 +03:00
|
|
|
- type: track_table
|
|
|
|
args:
|
|
|
|
schema: public
|
|
|
|
name: article
|
|
|
|
|
|
|
|
#Create author simple view
|
|
|
|
- type: track_table
|
|
|
|
args:
|
|
|
|
schema: public
|
|
|
|
name: author_simple
|
|
|
|
|
|
|
|
#Create author complex view
|
|
|
|
- type: track_table
|
|
|
|
args:
|
|
|
|
schema: public
|
|
|
|
name: author_complex
|
|
|
|
|
|
|
|
#Create object relations on views
|
|
|
|
- type: create_object_relationship
|
|
|
|
args:
|
|
|
|
table: article
|
|
|
|
name: author_simple
|
|
|
|
using:
|
|
|
|
manual_configuration:
|
|
|
|
remote_table: author_simple
|
|
|
|
column_mapping:
|
|
|
|
author_id: id
|
|
|
|
|
|
|
|
- type: create_object_relationship
|
|
|
|
args:
|
|
|
|
table: article
|
|
|
|
name: author_complex
|
|
|
|
using:
|
|
|
|
manual_configuration:
|
|
|
|
remote_table: author_complex
|
|
|
|
column_mapping:
|
|
|
|
author_id: author_id
|