Git Product home page Git Product logo

atlassian-connect-play-slick's Introduction

Atlassian Connect Play Slick

Continuous integration codecov Maven Central

Atlassian Connect Play Slick is a Play module providing Slick implementation for data repositories defined in Atlassian Connect Play.

Quick start

atlassian-connect-play-slick is published to Maven Central for Scala 2.13 and Play 2.8.x, so you can just add the following to your build:

libraryDependencies += "io.toolsplus" %% "atlassian-connect-play-slick" % "x.x.x"

JDBC driver dependency

The Play Slick module does not bundle any JDBC driver. Hence, you will need to explicitly add the JDBC driver(s) you want to use in your application.

For instance, if you would like to use an in-memory database such as H2, you will have to add a dependency to it:

libraryDependencies += "com.h2database" % "h2" % "${H2_VERSION}"

After that follow the Play Slick documentation on how to add the Slick database configuration to your application.conf. E.g.

slick.dbs.default.profile"="slick.jdbc.H2Profile$
slick.dbs.default.db.driver="org.h2.Driver"
slick.dbs.default.db.url="jdbc:h2:mem:play"

That's it! You now have a Slick database backend to store Atlassian hosts.

Using Play Evolutions

Play Slick supports Play database evolutions.

To enable evolutions, you will need the following dependencies:

libraryDependencies += "com.typesafe.play" %% "play-slick-evolutions" % "${PLAY_SLICK_VERSION}"

Note there is no need to add the Play evolutions component to your dependencies, as it is a transitive dependency of the play-slick-evolutions module.

Finally add the evolutions configuration to your application.conf:

evolutions {
    db {
        default {
            enabled = true
            autoApply = true
            autocommit = false
            useLocks = true
        }
    }
}

Refer to the Play database evolutions guide on configuration details.

Contributing

Pull requests are always welcome. Please follow the contribution guidelines.

License

atlassian-connect-play-slick is licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

atlassian-connect-play-slick's People

Contributors

tbinna avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

atlassian-connect-play-slick's Issues

Update Connect on Forge implementation to use mapping table

Connect on Forge installations require a table mapping unique Forge installation IDs to clientKeys, whereby different installationIds may map to the same clientKey.

Refer to the ACSB PR for details: https://bitbucket.org/atlassian/atlassian-connect-spring-boot/pull-requests/340/onecloud-3745-acsb-frc-support-added

Why is the mapping table from installation id to client key required?

For Forge Remote requests, we always have to look up the Atlassian host based on the Forge installation ID.

Forge installation id -> Atlassian host

Consider the following two scenarios:

  1. Uninstall and reinstall a Connect on Forge app on the same site.
  2. Perform an import on a site.

In the case of 1, the installation ID changes, but the client key remains the same. In the case of 2, the installation ID remains the same, but the client key changes, which can lead to having two Atlassian hosts with the same installation ID. The result of this is that searching the Atlassian host table by installation ID may result in more than one matching record. The mapping table will keep track of the latest installation ID -> Atlassian host mapping.

Make AtlassianHostTable public so it can be referenced in Slick tables of add-ons

Some add-ons might create additional Slick tables that store e.g. AtlassianHost.clientKey as a foreign key to to a Atlassian host in their data model.

To write a Slick foreignKey constraint you need access to the referenced Schema (i.e. AtlassianHostTable), see http://slick.lightbend.com/doc/3.2.0/schemas.html#constraints

Therefore I think it's better to make AtlassianHostTable public, so it can be referenced in the constraint.

Allow saving new host records with same base URL but different client keys

Under certain circumstances, Atlassian Connect sends installation requests for already installed host base URLs but different client keys. Currently, the implementation requires unique client keys and base URLs and rejects those requests (they can only appear once in the host table).

Relax the requirement by making the base URL index non-unique. This is how it is currently also done in Atlassian Connect Spring Boot.

https://ecosystem.atlassian.net/browse/ACSPRING-62
https://bitbucket.org/atlassian/atlassian-connect-spring-boot/commits/b8ecb0b12f2b94bece118cc21e267cc1229bdfcd

Connect on Forge

Update the repository implementation to include an optional installationId and allow finding an AtlassianHost based on a given installationId.

This work should follow based on the model update implemented in toolsplus/atlassian-connect-play#75

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.