Но в postgresql есть есть тип serial
вручную изменить тип поля на serial?
alter table foo alter COLUMN i type serial;
ERROR: type "serial" does not exist
2. unsigned
Оказывается его нет в postgresql. Заменить на CHECK (имя_поля >= 0)? Или ещё какие варианты (если есть, то чем они лучше)?
И опять-таки в миграциях лары нет никакого check()
3. массивы
Для mysql использовала string и туда записывала данные в виде json. Для postgresql пока выбрала прямо json. В миграциях он доступен. Или стоит выбрать тип массива? В чём разница между массивами и json в postgresql?
Что-то laravel, как я пока вижу, мало адаптирован к работе с postgresql.
create table new_city (like city including all);
insert into new_city select * from city;SELECT pglogical.replicate_ddl_command('ALTER TABLE public.aaa_plc_banned_domains ADD Phone2 CHARACTER VARYING(20)'); Под периодическим обслуживанием я подразумеваю vacuum, reindex, analyze
CAST ( expression AS type )
expression::type
The CAST syntax conforms to SQL; the syntax with :: is historical PostgreSQL usage.
ERROR: connection for foreign table "имя_таблицы" cannot be authenticated
select d as day,
(select count(*) from views where created_at >= d and created_at < (d + interval '1 day')) as views_count,
(select count(*) from items where created_at >= d and created_at < (d + interval '1 day')) as items_count
from generate_series('2018-12-26'::date, '2018-12-30', '1 day' ) as dates(d)
order by day descselect d as day, views_count, items_count
from generate_series('2018-12-26'::date, '2018-12-30', '1 day' ) as dates(d)
left join lateral (select count(*) as views_count from views where created_at >= d and created_at < (d + interval '1 day')) as v on true
left join lateral (select count(*) as views_count from items where created_at >= d and created_at < (d + interval '1 day')) as i on true
order by day descВерсия PHP 5.13