Category: PostgreSQL

  • Version control database schema using Flyway

    Many ORM framework like Django, Laravel comes with a nice database migration tool which let us update database schema in ease, also changes in database schema can be version controlled in the git repo. But if I’m not using any of such frameworks then how can I version control my database schema and use database…

  • PostgreSQL plsql method with json argument

    To get a element of json we can call with index name like this i_json::json->>’bar’ Here is a sample method with josn argument CREATE OR REPLACE FUNCTION my_sp_method(i_json JSON) RETURNS TEXT AS $$ BEGIN RETURN i_json::json->>’bar’; END; $$ LANGUAGE plpgsql; Calling with a json will return “world” which is the value of json index bar…