https://www.youtube.com/watch?v=U9nVo9MS12o&feature=emb_title https://www.youtube.com/watch?v=22TeQ8XWOlU
https://medium.com/responsive-br/versionando-o-banco-de-dados-com-liquibase-bfbf0b81d02f https://medium.com/responsive-br/aprofundando-um-pouco-mais-no-liquibase-a61d509344f8 https://fernandogodoy.wordpress.com/2019/02/21/conhecendo-o-liquibase/
https://www.liquibase.org/blog/using-liquibase-azure-postgres
https://medium.com/podiihq/getting-started-with-liquibase-8965897092aa https://www.smaato.com/blog/how-to-execute-database-migrations-with-liquibase/ https://stackoverflow.com/questions/11131978/how-to-tag-a-changeset-in-liquibase-to-rollback https://www.baeldung.com/liquibase-refactor-schema-of-java-app https://www.baeldung.com/liquibase-rollback https://stackoverflow.com/questions/34054638/can-liquibase-ignore-checksums-for-a-single-changeset
https://www.liquibase.org/blog/plain-sql https://docs.liquibase.com/concepts/basic/sql-format.html https://www.turtle-techies.com/how-to-write-xml-changesets-in-liquibase/
https://docs.liquibase.com/workflows/liquibase-community/existing-project.html
https://docs.liquibase.com/concepts/advanced/preconditions.html https://mohitgoyal.co/2019/03/26/check-database-state-and-conditionally-apply-changes-in-the-liquibase/ https://www.liquibase.org/blog/dealing-with-changing-changesets
https://docs.liquibase.com/tools-integrations/cli/home.html https://docs.liquibase.com/commands/community/home.html https://xenovation.com/blog/development/java/java-professional-developer/managing-databases-with-liquibase
export PATH=$PATH:/home/heitor/dev/liquibase/liquibase
liquibase --version
cd xml ou sql
liquibase update
liquibase --changeLogFile=dbchangelog.xml generateChangeLog
export PATH=$PATH:/home/heitor/dev/liquibase/liquibase
liquibase --version
liquibase status
liquibase update
liquibase updateSQL > script.sql
CREATE TABLE fruits(
id SERIAL PRIMARY KEY,
name VARCHAR NOT NULL
)
liquibase --changeLogFile=changelog/000.changelog.xml generateChangeLog
./mvnw liquibase:generateChangeLog -Dliquibase.outputChangeLogFile=000.changelog.xml
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="fruits"/>
</not>
</preConditions>
Ou marcar todos os changelogs como executados
liquibase changeLogSync
liquibase --changeLogFile=data/dados.sql --diffTypes="data" generateChangeLog
liquibase rollbackCountSQL 2
liquibase rollbackToDateSQL 2020-11-01
liquibase rollbackSQL version_002
./mvnw liquibase:rollback -Dliquibase.rollbackCount=2
./mvnw liquibase:rollback -Dliquibase.rollbackDate=Jun 03, 2017
./mvnw liquibase:rollback -Dliquibase.rollbackTag=version_002
liquibase tag version_003
liquibase diff
liquibase --outputFile=mydiff.txt diff
./mvnw liquibase:diff
./mvnw liquibase:diff -Dliquibase.outputFile=mydiff.txt
liquibase --changeLogFile=hmg.xml diffChangeLog
liquibase dbdoc doc/dbdoc
Liquibase Spatial http://lonnyj.github.io/liquibase-spatial/index.html
Fazer download do jar e colocar em liquibase/lib
liquibase status
liquibase updateSQL
liquibase update
https://xenovation.com/blog/development/java/java-professional-developer/managing-databases-with-liquibase https://gist.github.com/wilmoore/812253/45413ee9e97b5d5cfd8174efd08df7b7da788957
https://tableplus.com/blog/2018/04/postgresql-how-to-grant-access-to-users.html https://medium.com/coding-blocks/creating-user-database-and-adding-access-on-postgresql-8bfcd2f4a91e https://www.postgresqltutorial.com/postgresql-roles/
sudo -u postgres psql
postgres=# create database mydb;
postgres=# create user myuser with encrypted password 'mypass';
postgres=# grant all privileges on database mydb to myuser;
CREATE DATABASE yourdbname;
CREATE USER youruser WITH ENCRYPTED PASSWORD 'yourpass';
GRANT ALL PRIVILEGES ON DATABASE yourdbname TO youruser;
https://stackoverflow.com/questions/41537825/restricted-postgresql-permissions-for-web-app;
/* create the database */
\c postgres postgres
CREATE DATABASE test_database WITH OWNER app_admin;
\c test_database postgres
/* drop public schema; other, less invasive option is to
REVOKE ALL ON SCHEMA public FROM PUBLIC */
DROP SCHEMA public;
/* create an application schema */
CREATE SCHEMA app AUTHORIZATION app_admin;
/* further operations won't need superuser access */
\c test_database app_admin
/* allow app_user to access, but not create objects in the schema */
GRANT USAGE ON SCHEMA app TO app_user;
/* PUBLIC should not be allowed to execute functions created by app_admin */
ALTER DEFAULT PRIVILEGES FOR ROLE app_admin
REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
/* assuming that app_user should be allowed to do anything
with data in all tables in that schema, allow access for all
objects that app_admin will create there */
ALTER DEFAULT PRIVILEGES FOR ROLE app_admin IN SCHEMA app
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO app_user;
ALTER DEFAULT PRIVILEGES FOR ROLE app_admin IN SCHEMA app
GRANT SELECT, USAGE ON SEQUENCES TO app_user;
ALTER DEFAULT PRIVILEGES FOR ROLE app_admin IN SCHEMA app
GRANT EXECUTE ON FUNCTIONS TO app_user;