{"id":18694330,"url":"https://github.com/csev/idempotent","last_synced_at":"2025-07-26T15:11:41.938Z","repository":{"id":209327092,"uuid":"723757188","full_name":"csev/idempotent","owner":"csev","description":"A Simple Sakai Database Evolver","archived":false,"fork":false,"pushed_at":"2024-12-28T16:08:18.000Z","size":74,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-12T23:42:53.626Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-11-26T17:11:01.000Z","updated_at":"2024-12-28T16:08:21.000Z","dependencies_parsed_at":"2025-05-19T04:01:14.538Z","dependency_job_id":null,"html_url":"https://github.com/csev/idempotent","commit_stats":null,"previous_names":["csev/idempotent"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/csev/idempotent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csev%2Fidempotent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csev%2Fidempotent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csev%2Fidempotent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csev%2Fidempotent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csev","download_url":"https://codeload.github.com/csev/idempotent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csev%2Fidempotent/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267184095,"owners_count":24049127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T11:09:51.621Z","updated_at":"2025-07-26T15:11:41.895Z","avatar_url":"https://github.com/csev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Idempotent\n==========\n\nIdempotent is a Sakai Servlet that allow us to build automated database\nmigrations that can be applied each time Sakai is compiled and started.\n\n\u003e Idempotence is the property of certain operations in mathematics and\ncomputer science whereby they can be applied multiple times without\nchanging the result beyond the initial\napplication. - https://en.wikipedia.org/wiki/Idempotence\n\nThis works best for simple schema changes like adding a column to an\nexisting table.\n\nSee the [DESIGN.md](DESIGN.md) file for more information on the\napproach used in this project.\n\nConfiguration\n-------------\n\nTo enable Idempotent in your Sakai instance (once it is installed) you must\nadd the following to your `sakai.properties`:\n\n    idempotent.enabled=true\n\nInstallation\n------------\n\nIdempotent is designed to be part of the Sakai distribution as a top-level\nfolder.  But for now it is in a separate repo like a contrib tool so you\nmust manually install it.\n\nFirst you go into your Sakai source tree and check out this repo:\n\n    cd ~/sakai/scripts/trunk\n\n    git clone https://github.com/csev/idempotent.git\n    cd idempotent\n\nUntil this is in the main repo, it does not ship with a `pom.xml`,\nso you must copy one of the given versions of the `pom.xml` to\n`pom.xml`:\n\n    git checkout main\n    cp pom-25-SNAPSHOT.xml pom.xml\n    cp servlet/pom-25-SNAPSHOT.xml servlet/pom.xml\n\nor\n\n    git checkout 23.x\n    cp pom-23-SNAPSHOT.xml pom.xml\n    cp servlet/pom-23-SNAPSHOT.xml servlet/pom.xml\n\nThen just compile it:\n\n    mvn -Dmaven.tomcat.home=/Users/csev/sakai/scripts/apache-tomcat-9.0.21 clean install sakai:deploy\n\nIt is installed in your Tomcat - it does not even need a Tomcat restart.  When the\nservlet comes up - either because of a fresh deploy or when Sakai is started, it loads\nand does its idempotent thing.\n\nIf you are using the Dr. Chuck `sakai-scripts`, a partial compile is done with the `smv.sh`\ncommand.\n\nIf it runs any SQL - that is displayed with a `log.info`.  The very first run, it will create\nits table to track migrations:\n\n    o.s.i.Util.ensureIdempotentTable Creating the SAKAI_IDEMPOTENT Table\n    o.s.i.Util.runUpdateSql IDEMPOTENT-001(0): CREATE TABLE SAKAI_IDEMPOTENT ( MIGRATION_ID INT\n        NOT NULL AUTO_INCREMENT, NOTE VARCHAR (256) NOT NULL, SQL_TEXT VARCHAR (1024) NOT NULL,\n        CREATEDON DATETIME NULL,PRIMARY KEY (MIGRATION_ID) )\n\nWhen it detects that a migration is needed it runs logs the SQL:\n\n    o.s.i.Util.runMigrationOnce SAK-49633(1): UPDATE SAKAI_SITE SET TYPE='course'\n        WHERE SITE_ID = '!plussite';\n\nOnce it has run the migrations, every time the webapp deploys and starts, it will check if\nthere are any migrations yet to run, and usually finding none it will have no log messages\nat all.\n\nFrom time to time, if this is not in the main repo, go into the `idempotent` folder\ndo a `git pull` and recompile using `mvn`.   You don't even need to restart Sakai.\nWith this approach your schema might time travel into the future a bit, but if\nthe SQL in idempotent is truly idempotent, that is OK.  It is better to have a column\nthat is unused before you get the code that will break without the column.\n\nSakai's Conversion Scripts\n--------------------------\n\nIn general, the current official source of these conversions is a set of versoin-based conversion scripts:\n\nhttps://github.com/sakaiproject/sakai-reference/tree/master/docs/conversion\n\nTODO: Work to be done\n---------------------\n\nInvestigate: https://www.sitepoint.com/schema-migration-hibernate-flywaydb/\n\nThis should almost work with Oracle - the `SAKAI_IDEMPOTENT` table creation SQL needs\nto be better and have a sequence.  And the `INSERT` statement in `Util.recordMigration()`\nneeds to be different for Oracle.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsev%2Fidempotent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsev%2Fidempotent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsev%2Fidempotent/lists"}