drop table if exists larticles;
create table larticles(
	article_id integer not null references articles( article_id ),
	site_language_id integer not null references site_languages( site_language_id ),
	larticle_title varchar(128),
	larticle_ctstamp timestamp without time zone default now(),
	larticle_publication_tstamp timestamp without time zone,
	larticle_depublication_tstamp timestamp without time zone,
	larticle_tech_mtstamp bigint,
	larticle_lead text,
	larticle_body text,
	larticle_extra_head text,
	larticle_url varchar(255),
	is_url_used boolean default false,
	is_active boolean default true,
	is_public boolean default true,
	is_deleted boolean default false,
	oldid integer,
	constraint larticles_pkey primary key( article_id , site_language_id )
);

comment on table larticles is 'storage of language articles';
comment on column larticles.article_id is 'reference id to articles table';
comment on column larticles.site_language_id is 'reference id to site_languages table';
comment on column larticles.larticle_title is 'name of the article';
comment on column larticles.larticle_ctstamp is 'creation timestamp of language article (only not null is overriding language timestamp)';
comment on column larticles.larticle_publication_tstamp is 'publication timestamp of language article (only not null is overriding language timestamp)';
comment on column larticles.larticle_depublication_tstamp is 'depublication timestamp of language article (only not null is overriding language timestamp)';
comment on column larticles.larticle_tech_mtstamp is 'technical last modification timestamp (epoch)';
comment on column larticles.larticle_lead is 'lead of the language article';
comment on column larticles.larticle_body is 'language article body';
comment on column larticles.larticle_extra_head is 'language article extra head (may contain javascript)';
comment on column larticles.larticle_url is 'url of the language article';
comment on column larticles.is_url_used is 'is url used on fallback';
comment on column larticles.is_active is 'is active flag of language article';
comment on column larticles.is_public is 'is public flag of language article';
comment on column larticles.is_deleted is 'is deleted flag of language article';
comment on column larticles.oldid is 'old id from fordit v2';

comment on constraint larticles_pkey on larticles is 'unique constraint of table';
comment on constraint larticles_article_id_fkey on larticles is 'foreign constraint to articles table';
comment on constraint larticles_site_language_id_fkey on larticles is 'foreign constraint to site_languages table';
