terminal >curl -X POST http://canary.local.test:5000/posts -H "Content-Type: application/json" -d "{\"title\": \"First Blog Post\", \"author\": \"Author A\", \"body\": \"This is the content of the first blog post.\"}"
{
"message": "Post created successfully"
}
terminal >curl -X POST http://tenant2.local.test:5000/posts -H "Content-Type: application/json" -d "{\"title\": \"Second Blog Post\", \"author\": \"Author B\", \"body\": \"This is the content of the second blog post.\"}"
{
"message": "Post created successfully"
}
terminal >curl -X POST http://tenant2.local.test:5000/posts -H "Content-Type: application/json" -d "{\"title\": \"Second Blog Post\", \"author\": \"Author B\", \"body\": \"This is the content of the third blog post.\"}"
<!doctype html>
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "canary.posts" does not exist
LINE 1: INSERT INTO canary.posts (title, body, author) VALUES ('Seco...
Oberve that at the end, creating a tenant-scoped Post t otenant2 tries to create it in the canary schema.
terminal >curl -X POST http://local.test:5000/create_tenant -H "Content-Type: application/json" -d "{\"name\": \"canary\", \"domain_name\": \"canary.local.test\", \"phone_number\": \"123-456-7890\", \"address\": \"123 Example St\"}" { "message": "Tenant canary created successfully", "tenant": { "address": "123 Example St", "domain_name": "canary.local.test", "id": 1, "name": "canary", "phone_number": "123-456-7890" } }
terminal >curl -X POST http://canary.local.test:5000/posts -H "Content-Type: application/json" -d "{\"title\": \"First Blog Post\", \"author\": \"Author A\", \"body\": \"This is the content of the first blog post.\"}" { "message": "Post created successfully" }
terminal >curl -X POST http://local.test:5000/create_tenant -H "Content-Type: application/json" -d "{\"name\": \"tenant2\", \"domain_name\": \"tenant2.local.test\", \"phone_number\": \"987-654-3210\", \"address\": \"456 Updated St\"}" { "message": "Tenant tenant2 created successfully", "tenant": { "address": "456 Updated St", "domain_name": "tenant2.local.test", "id": 2, "name": "tenant2", "phone_number": "987-654-3210" } }
terminal >curl -X POST http://tenant2.local.test:5000/posts -H "Content-Type: application/json" -d "{\"title\": \"Second Blog Post\", \"author\": \"Author B\", \"body\": \"This is the content of the second blog post.\"}" { "message": "Post created successfully" }
terminal >curl -X DELETE http://local.test:5000/delete_tenant/canary -H "Content-Type: application/json" { "message": "Tenant and its schema deleted successfully" }
terminal >curl -X POST http://tenant2.local.test:5000/posts -H "Content-Type: application/json" -d "{\"title\": \"Second Blog Post\", \"author\": \"Author B\", \"body\": \"This is the content of the third blog post.\"}" <!doctype html>